A-yum1 commited on
Commit
b5703d2
·
1 Parent(s): 8b37e01

Update app.py

Browse files
__pycache__/transcription.cpython-310.pyc CHANGED
Binary files a/__pycache__/transcription.cpython-310.pyc and b/__pycache__/transcription.cpython-310.pyc differ
 
app.py CHANGED
@@ -41,8 +41,7 @@ def feedback():
41
  @app.route('/talk_detail', methods=['GET', 'POST'])
42
  def talk_detail():
43
  return render_template('talkDetail.html')
44
- # トップページ(テンプレート: index.html)
45
- @app.route('/')
46
  # 音声登録画面(テンプレート: userRegister.html)
47
  @app.route('/userregister', methods=['GET', 'POST'])
48
  def userregister():
@@ -348,10 +347,13 @@ def upload_audio():
348
  except Exception as e:
349
  print("Error in /upload_audio:", str(e))
350
  return jsonify({"error": "サーバーエラー", "details": str(e)}), 500
 
351
  # ユーザー選択画面(テンプレート: userSelect.html)
 
352
  @app.route('/userselect', methods=['GET'])
353
  def userselect():
354
  return render_template('userSelect.html')
 
355
  # 選択したユーザーを設定するエンドポイント
356
  @app.route('/select_users', methods=['POST'])
357
  def select_users():
@@ -374,6 +376,24 @@ def select_users():
374
  def reset():
375
  global users
376
  users = []
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
377
  return jsonify({"status": "success", "message": "Users reset"}), 200
378
 
379
  @app.route('/copy_selected_files', methods=['POST'])
 
41
  @app.route('/talk_detail', methods=['GET', 'POST'])
42
  def talk_detail():
43
  return render_template('talkDetail.html')
44
+
 
45
  # 音声登録画面(テンプレート: userRegister.html)
46
  @app.route('/userregister', methods=['GET', 'POST'])
47
  def userregister():
 
347
  except Exception as e:
348
  print("Error in /upload_audio:", str(e))
349
  return jsonify({"error": "サーバーエラー", "details": str(e)}), 500
350
+
351
  # ユーザー選択画面(テンプレート: userSelect.html)
352
+ @app.route('/')
353
  @app.route('/userselect', methods=['GET'])
354
  def userselect():
355
  return render_template('userSelect.html')
356
+
357
  # 選択したユーザーを設定するエンドポイント
358
  @app.route('/select_users', methods=['POST'])
359
  def select_users():
 
376
  def reset():
377
  global users
378
  users = []
379
+ global total_audio
380
+ global transcription_text
381
+
382
+ # 一時ディレクトリのクリーンアップ
383
+ if total_audio:
384
+ process.delete_files_in_directory(total_audio)
385
+ process.delete_files_in_directory('/tmp/data/transcription_audio')
386
+
387
+ # 書き起こしテキストの削除
388
+ if os.path.exists(transcription_text):
389
+ try:
390
+ os.remove(transcription_text)
391
+ print(f"{transcription_text} を削除しました。")
392
+ except Exception as e:
393
+ print(f"ファイル削除中にエラーが発生しました: {e}")
394
+
395
+ transcription_text = ""
396
+
397
  return jsonify({"status": "success", "message": "Users reset"}), 200
398
 
399
  @app.route('/copy_selected_files', methods=['POST'])