Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -68,6 +68,10 @@ def text2speech(text):
|
|
68 |
define voice -> gpt -> text -> voice workflow
|
69 |
"""
|
70 |
def transcribe(audio):
|
|
|
|
|
|
|
|
|
71 |
#global messages
|
72 |
|
73 |
"""
|
@@ -124,11 +128,12 @@ def transcribe(audio):
|
|
124 |
|
125 |
output_text = gr.outputs.Textbox(label="Chat Messages")
|
126 |
|
127 |
-
output_audio = gr.outputs.Audio(
|
128 |
-
|
129 |
-
gr.Interface(
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
|
|
|
68 |
define voice -> gpt -> text -> voice workflow
|
69 |
"""
|
70 |
def transcribe(audio):
|
71 |
+
messages = chat.generate_dialogue(audio)
|
72 |
+
voice_path = chat.synthesize_voice(messages)
|
73 |
+
chat_text = "\n".join([f"{msg['role']}: {msg['content']}" for msg in messages])
|
74 |
+
return voice_path, chat_text
|
75 |
#global messages
|
76 |
|
77 |
"""
|
|
|
128 |
|
129 |
output_text = gr.outputs.Textbox(label="Chat Messages")
|
130 |
|
131 |
+
output_audio = gr.outputs.Audio(label="Synthesized Voice")
|
132 |
+
output_text = gr.outputs.Textbox(label="Chat Messages")
|
133 |
+
gr.Interface(
|
134 |
+
fn=transcribe,
|
135 |
+
inputs=gr.inputs.Audio(source="microphone", label="Speak here..."),
|
136 |
+
outputs=[output_audio, output_text],
|
137 |
+
live=True,
|
138 |
+
allow_flagging='never'
|
139 |
+
).launch()
|