Spaces:
Runtime error
Runtime error
codingchild
commited on
Commit
β’
d19da7b
1
Parent(s):
cc33a71
change execute_stt
Browse files
app.py
CHANGED
@@ -467,13 +467,13 @@ def generate_response(prompt):
|
|
467 |
|
468 |
def execute_stt(audio, error_message):
|
469 |
|
470 |
-
#
|
471 |
-
|
472 |
-
|
|
|
473 |
|
474 |
wav_file = open(user_audio_path, "wb")
|
475 |
wav_file.write(audio.tobytes())
|
476 |
-
#wav_file.close()
|
477 |
|
478 |
try:
|
479 |
user_input = whisper_transcribe(wav_file)
|
@@ -482,6 +482,7 @@ def execute_stt(audio, error_message):
|
|
482 |
time.sleep(1)
|
483 |
st.experimental_rerun()
|
484 |
|
|
|
485 |
wav_file.close()
|
486 |
|
487 |
return user_input
|
|
|
467 |
|
468 |
def execute_stt(audio, error_message):
|
469 |
|
470 |
+
# audio κΈ°λ‘ λμ
|
471 |
+
user_audio_path = "audio/" + str(st.session_state.user_id) + "_" + str(st.session_state.session_num) + "_" + str(time.time()) + ".wav"
|
472 |
+
# audio κΈ°λ‘μ λμ νκ³ μΆμ§ μλ€λ©΄
|
473 |
+
# user_audio_path = "audio/audio.wav"
|
474 |
|
475 |
wav_file = open(user_audio_path, "wb")
|
476 |
wav_file.write(audio.tobytes())
|
|
|
477 |
|
478 |
try:
|
479 |
user_input = whisper_transcribe(wav_file)
|
|
|
482 |
time.sleep(1)
|
483 |
st.experimental_rerun()
|
484 |
|
485 |
+
# close file
|
486 |
wav_file.close()
|
487 |
|
488 |
return user_input
|