Spaces:
Running
on
T4
Running
on
T4
Commit
•
c34843b
1
Parent(s):
afbb09b
Add code
Browse files
app.py
CHANGED
@@ -54,8 +54,6 @@ OUT_CHUNK = 20 * 4096
|
|
54 |
|
55 |
|
56 |
def response(audio: tuple[int, np.ndarray], conversation: list[dict], img: str | None):
|
57 |
-
conversation.append({"role": "user", "content": gr.Audio(audio)})
|
58 |
-
yield AdditionalOutputs(conversation)
|
59 |
|
60 |
sampling_rate, audio_np = audio
|
61 |
audio_np = audio_np.squeeze()
|
@@ -69,6 +67,7 @@ def response(audio: tuple[int, np.ndarray], conversation: list[dict], img: str |
|
|
69 |
)
|
70 |
|
71 |
segment.export(audio_buffer, format="wav")
|
|
|
72 |
conversation.append({"role": "assistant", "content": ""})
|
73 |
|
74 |
base64_encoded = str(base64.b64encode(audio_buffer.getvalue()), encoding="utf-8")
|
|
|
54 |
|
55 |
|
56 |
def response(audio: tuple[int, np.ndarray], conversation: list[dict], img: str | None):
|
|
|
|
|
57 |
|
58 |
sampling_rate, audio_np = audio
|
59 |
audio_np = audio_np.squeeze()
|
|
|
67 |
)
|
68 |
|
69 |
segment.export(audio_buffer, format="wav")
|
70 |
+
conversation.append({"role": "user", "content": gr.Audio((sampling_rate, audio_np))})
|
71 |
conversation.append({"role": "assistant", "content": ""})
|
72 |
|
73 |
base64_encoded = str(base64.b64encode(audio_buffer.getvalue()), encoding="utf-8")
|