Spaces:
Running
Running
Update app.py
Browse files- __pycache__/process.cpython-310.pyc +0 -0
- app.py +20 -8
__pycache__/process.cpython-310.pyc
CHANGED
Binary files a/__pycache__/process.cpython-310.pyc and b/__pycache__/process.cpython-310.pyc differ
|
|
app.py
CHANGED
@@ -57,9 +57,18 @@ def reset_html():
|
|
57 |
def reset_member():
|
58 |
global users
|
59 |
global total_audio
|
60 |
-
|
61 |
process.delete_files_in_directory(total_audio)
|
62 |
process.delete_files_in_directory('/tmp/data/transcription_audio')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
try:
|
64 |
data = request.get_json()
|
65 |
if not data or "names" not in data:
|
@@ -97,14 +106,17 @@ def reset_member():
|
|
97 |
def transcription():
|
98 |
global transcription_text
|
99 |
global total_audio
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
|
|
|
|
|
|
|
|
|
|
105 |
return jsonify({'transcription': file_content}),200
|
106 |
-
except Exception as e:
|
107 |
-
return jsonify({"error": str(e)}),500
|
108 |
|
109 |
# AI分析エンドポイント
|
110 |
@app.route('/analyze',methods =['GET','POST'])
|
|
|
57 |
def reset_member():
|
58 |
global users
|
59 |
global total_audio
|
60 |
+
global transcription_text
|
61 |
process.delete_files_in_directory(total_audio)
|
62 |
process.delete_files_in_directory('/tmp/data/transcription_audio')
|
63 |
+
try:
|
64 |
+
if os.path.exists(transcription_text):
|
65 |
+
os.remove(transcription_text)
|
66 |
+
print(f"{transcription_text} を削除しました。")
|
67 |
+
else:
|
68 |
+
print(f"{transcription_text} は存在しません。")
|
69 |
+
except Exception as e:
|
70 |
+
print(f"エラーが発生しました: {e}")
|
71 |
+
transcription_text = ""
|
72 |
try:
|
73 |
data = request.get_json()
|
74 |
if not data or "names" not in data:
|
|
|
106 |
def transcription():
|
107 |
global transcription_text
|
108 |
global total_audio
|
109 |
+
print(transcription_text)
|
110 |
+
if transcription_text == "":
|
111 |
+
try:
|
112 |
+
audio_directory = transcripter.merge_segments(total_audio,'/tmp/data/transcription_audio')
|
113 |
+
transcription_text = transcripter.create_transcription(audio_directory)
|
114 |
+
except Exception as e:
|
115 |
+
return jsonify({"error": str(e)}),500
|
116 |
+
transcription_text
|
117 |
+
with open(transcription_text,'r',encoding='utf-8') as file:
|
118 |
+
file_content = file.read()
|
119 |
return jsonify({'transcription': file_content}),200
|
|
|
|
|
120 |
|
121 |
# AI分析エンドポイント
|
122 |
@app.route('/analyze',methods =['GET','POST'])
|