Update app.py
Browse files
app.py
CHANGED
|
@@ -186,12 +186,14 @@ def main_interface(user_prompt, image=None, video=None, audio=None, doc=None, vo
|
|
| 186 |
tts_model.to("cuda")
|
| 187 |
unet.to("cuda", torch.float16)
|
| 188 |
image_pipe.to("cuda")
|
|
|
|
| 189 |
response = handle_input(user_prompt, image=image, video=video, audio=audio, doc=doc)
|
|
|
|
| 190 |
if voice_only:
|
| 191 |
audio_file = play_voice_output(response)
|
| 192 |
-
return
|
| 193 |
else:
|
| 194 |
-
return response
|
| 195 |
|
| 196 |
# Gradio App Setup
|
| 197 |
with gr.Blocks() as demo:
|
|
@@ -208,7 +210,7 @@ with gr.Blocks() as demo:
|
|
| 208 |
submit.click(
|
| 209 |
fn=main_interface,
|
| 210 |
inputs=[user_prompt, image_input, video_input, audio_input, doc_input, voice_only_mode],
|
| 211 |
-
outputs=[output_label, audio_output]
|
| 212 |
)
|
| 213 |
|
| 214 |
demo.launch(inline=False)
|
|
|
|
| 186 |
tts_model.to("cuda")
|
| 187 |
unet.to("cuda", torch.float16)
|
| 188 |
image_pipe.to("cuda")
|
| 189 |
+
|
| 190 |
response = handle_input(user_prompt, image=image, video=video, audio=audio, doc=doc)
|
| 191 |
+
|
| 192 |
if voice_only:
|
| 193 |
audio_file = play_voice_output(response)
|
| 194 |
+
return response, audio_file # Return both text and audio outputs
|
| 195 |
else:
|
| 196 |
+
return response, None # Return only the text output, no audio
|
| 197 |
|
| 198 |
# Gradio App Setup
|
| 199 |
with gr.Blocks() as demo:
|
|
|
|
| 210 |
submit.click(
|
| 211 |
fn=main_interface,
|
| 212 |
inputs=[user_prompt, image_input, video_input, audio_input, doc_input, voice_only_mode],
|
| 213 |
+
outputs=[output_label, audio_output] # Expecting a string and audio file
|
| 214 |
)
|
| 215 |
|
| 216 |
demo.launch(inline=False)
|