Spaces:
Runtime error
Runtime error
Commit
·
5075bfa
1
Parent(s):
4c628f2
code'
Browse files
app.py
CHANGED
@@ -65,8 +65,8 @@ frame_rate = model.audio_encoder.config.frame_rate
|
|
65 |
|
66 |
|
67 |
def generate_response(audio):
|
68 |
-
|
69 |
-
question = client.automatic_speech_recognition(audio)
|
70 |
|
71 |
messages = [{"role": "sytem", "content": ("You are a magic 8 ball."
|
72 |
"Someone will present to you a situation or question and your job "
|
@@ -76,7 +76,7 @@ def generate_response(audio):
|
|
76 |
|
77 |
response = client.chat_completion(messages, max_tokens=128, seed=random.randint(1, 5000))
|
78 |
response = response.choices[0].message.content
|
79 |
-
|
80 |
|
81 |
|
82 |
@spaces.GPU
|
@@ -121,7 +121,7 @@ with gr.Blocks() as block:
|
|
121 |
)
|
122 |
with gr.Group():
|
123 |
with gr.Row():
|
124 |
-
audio_out = gr.Audio(visible=False, streaming=True)
|
125 |
answer = gr.Textbox(visible=False, label="Answer")
|
126 |
state = gr.State()
|
127 |
|
|
|
65 |
|
66 |
|
67 |
def generate_response(audio):
|
68 |
+
gr.Info("Transcribing Audio", duration=5)
|
69 |
+
question = client.automatic_speech_recognition(audio).text
|
70 |
|
71 |
messages = [{"role": "sytem", "content": ("You are a magic 8 ball."
|
72 |
"Someone will present to you a situation or question and your job "
|
|
|
76 |
|
77 |
response = client.chat_completion(messages, max_tokens=128, seed=random.randint(1, 5000))
|
78 |
response = response.choices[0].message.content
|
79 |
+
return response, gr.Textbox(visible=True)
|
80 |
|
81 |
|
82 |
@spaces.GPU
|
|
|
121 |
)
|
122 |
with gr.Group():
|
123 |
with gr.Row():
|
124 |
+
audio_out = gr.Audio(visible=False, streaming=True, autoplay=True)
|
125 |
answer = gr.Textbox(visible=False, label="Answer")
|
126 |
state = gr.State()
|
127 |
|