DLI-SLQ commited on
Commit
985726e
1 Parent(s): 99fb0c5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -5
app.py CHANGED
@@ -47,13 +47,11 @@ with gr.Blocks(theme=gr.themes.Base()) as blocks:
47
  def process_and_output(text):
48
  audio, message = synthesize_speech(text)
49
  if message:
50
- output_text.update(message)
51
- output_audio.update(None)
52
  else:
53
- output_audio.update(audio)
54
- output_text.update(None)
55
 
56
  submit_button.click(process_and_output, inputs=input_text, outputs=[output_audio, output_text])
57
 
58
  # Run the app
59
- blocks.launch()
 
47
  def process_and_output(text):
48
  audio, message = synthesize_speech(text)
49
  if message:
50
+ return None, message # Return None for audio and the error message
 
51
  else:
52
+ return audio, None # Return the audio data and None for the message
 
53
 
54
  submit_button.click(process_and_output, inputs=input_text, outputs=[output_audio, output_text])
55
 
56
  # Run the app
57
+ blocks.launch()