codingchild commited on
Commit
d19da7b
β€’
1 Parent(s): cc33a71

change execute_stt

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -467,13 +467,13 @@ def generate_response(prompt):
467
 
468
  def execute_stt(audio, error_message):
469
 
470
- # 아무 말도 μž…λ ₯λ˜μ§€ μ•Šμ•˜μ„λ•Œ, 과거의 audio 파일이 μž…λ ₯λ˜λŠ” ν˜„μƒμ΄ μžˆμ—ˆμŒ
471
- # μ˜€λ””μ˜€ 파일의 이름을 μžλ™μœΌλ‘œ λ³€κ²½ν•˜λ„λ‘ 섀정함 ([user_id]_[sesssion_num]_[real_time_stamp].wav)
472
- user_audio_path = "audio/audio.wav" #"audio/" + str(st.session_state.user_id) + "_" + str(st.session_state.session_num) + "_" + str(time.time()) + ".wav"
 
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