Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -39,13 +39,13 @@ def model(text):
|
|
| 39 |
|
| 40 |
return output
|
| 41 |
|
| 42 |
-
def respond(audio):
|
| 43 |
user = transcribe(audio)
|
| 44 |
reply = model(user)
|
| 45 |
communicate = edge_tts.Communicate(reply)
|
| 46 |
with tempfile.NamedTemporaryFile(delete=False, suffix=".wav") as tmp_file:
|
| 47 |
tmp_path = tmp_file.name
|
| 48 |
-
communicate.save(tmp_path)
|
| 49 |
return tmp_path
|
| 50 |
|
| 51 |
with gr.Blocks() as voice:
|
|
@@ -56,7 +56,9 @@ with gr.Blocks() as voice:
|
|
| 56 |
fn=respond,
|
| 57 |
inputs=[input],
|
| 58 |
outputs=[output],
|
| 59 |
-
live=True
|
|
|
|
|
|
|
| 60 |
)
|
| 61 |
|
| 62 |
theme = gr.themes.Base()
|
|
|
|
| 39 |
|
| 40 |
return output
|
| 41 |
|
| 42 |
+
async def respond(audio):
|
| 43 |
user = transcribe(audio)
|
| 44 |
reply = model(user)
|
| 45 |
communicate = edge_tts.Communicate(reply)
|
| 46 |
with tempfile.NamedTemporaryFile(delete=False, suffix=".wav") as tmp_file:
|
| 47 |
tmp_path = tmp_file.name
|
| 48 |
+
await communicate.save(tmp_path)
|
| 49 |
return tmp_path
|
| 50 |
|
| 51 |
with gr.Blocks() as voice:
|
|
|
|
| 56 |
fn=respond,
|
| 57 |
inputs=[input],
|
| 58 |
outputs=[output],
|
| 59 |
+
live=True,
|
| 60 |
+
api_name="voice_chat",
|
| 61 |
+
title="Voice Chat"
|
| 62 |
)
|
| 63 |
|
| 64 |
theme = gr.themes.Base()
|