OuroborosM commited on
Commit
7addf28
·
1 Parent(s): 57476cc

update sound

Browse files
Files changed (1) hide show
  1. app.py +11 -1
app.py CHANGED
@@ -908,6 +908,17 @@ def Text2Sound_HMI():
908
  text_to_speech_2(last_answer)
909
  Filename_Chatbot = Audio_output[0]
910
  print("Filename_Chatbot in Text2Sound_HMI", Filename_Chatbot)
 
 
 
 
 
 
 
 
 
 
 
911
 
912
  global last_answer
913
  last_answer = ""
@@ -1037,7 +1048,6 @@ with gr.Blocks() as demo:
1037
  frash_logs.click(read_logs, None, logs)
1038
  voice_input.stop_recording(SingleTalk, [voice_input, chatbot], [voice_input, voice_output, chatbot]).\
1039
  success(Text2Sound_HMI,None,None).\
1040
- success(playsound, None, voice_output).\
1041
  success(ClearAudio, None, voice_output)
1042
  # voice_output.end(ClearAudio, None, voice_output)
1043
  # def clear_voice():
 
908
  text_to_speech_2(last_answer)
909
  Filename_Chatbot = Audio_output[0]
910
  print("Filename_Chatbot in Text2Sound_HMI", Filename_Chatbot)
911
+ try:
912
+ if Filename_Chatbot.split(".")[1] == 'wav':
913
+ soundfilename = Filename_Chatbot
914
+ print("soundfilename:", soundfilename)
915
+ # return None
916
+ return gr.update(value = soundfilename)
917
+ # return soundfilename
918
+ # yield soundfilename
919
+ except Exception as e:
920
+ print("playsound error:", e)
921
+ return None
922
 
923
  global last_answer
924
  last_answer = ""
 
1048
  frash_logs.click(read_logs, None, logs)
1049
  voice_input.stop_recording(SingleTalk, [voice_input, chatbot], [voice_input, voice_output, chatbot]).\
1050
  success(Text2Sound_HMI,None,None).\
 
1051
  success(ClearAudio, None, voice_output)
1052
  # voice_output.end(ClearAudio, None, voice_output)
1053
  # def clear_voice():