Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,20 +7,23 @@ from datetime import datetime
|
|
| 7 |
|
| 8 |
app = Flask(__name__)
|
| 9 |
|
|
|
|
| 10 |
@app.route('/')
|
| 11 |
-
@app.route('/index',methods=['POST'])
|
| 12 |
def index():
|
| 13 |
return render_template('index.html')
|
| 14 |
|
| 15 |
-
|
|
|
|
| 16 |
def feedback():
|
| 17 |
return render_template("feedback.html")
|
| 18 |
|
| 19 |
-
|
|
|
|
| 20 |
def talk_detail():
|
| 21 |
return render_template("talkDetail.html")
|
| 22 |
|
| 23 |
-
|
| 24 |
@app.route('/upload_audio', methods=['POST'])
|
| 25 |
def upload_audio():
|
| 26 |
try:
|
|
@@ -42,7 +45,7 @@ def upload_audio():
|
|
| 42 |
persist_dir = "/tmp/data"
|
| 43 |
os.makedirs(persist_dir, exist_ok=True)
|
| 44 |
|
| 45 |
-
filepath = os.path.join(persist_dir, generate_filename(6))
|
| 46 |
with open(filepath, 'wb') as f:
|
| 47 |
f.write(audio_binary)
|
| 48 |
|
|
|
|
| 7 |
|
| 8 |
app = Flask(__name__)
|
| 9 |
|
| 10 |
+
# トップページ(GET/POSTどちらにも対応)
|
| 11 |
@app.route('/')
|
| 12 |
+
@app.route('/index', methods=['GET', 'POST'])
|
| 13 |
def index():
|
| 14 |
return render_template('index.html')
|
| 15 |
|
| 16 |
+
# フィードバック画面(GET/POSTどちらにも対応)
|
| 17 |
+
@app.route('/feedback', methods=['GET', 'POST'])
|
| 18 |
def feedback():
|
| 19 |
return render_template("feedback.html")
|
| 20 |
|
| 21 |
+
# 会話詳細画面(GET/POSTどちらにも対応)
|
| 22 |
+
@app.route('/talk_detail', methods=['GET', 'POST'])
|
| 23 |
def talk_detail():
|
| 24 |
return render_template("talkDetail.html")
|
| 25 |
|
| 26 |
+
# 音声データアップロード用エンドポイント
|
| 27 |
@app.route('/upload_audio', methods=['POST'])
|
| 28 |
def upload_audio():
|
| 29 |
try:
|
|
|
|
| 45 |
persist_dir = "/tmp/data"
|
| 46 |
os.makedirs(persist_dir, exist_ok=True)
|
| 47 |
|
| 48 |
+
filepath = os.path.join(persist_dir, generate_filename(6)) # ここだけ変更しました
|
| 49 |
with open(filepath, 'wb') as f:
|
| 50 |
f.write(audio_binary)
|
| 51 |
|