Spaces:
Running
on
L40S
Running
on
L40S
Update app.py
#4
by
SpicyqSama007
- opened
app.py
CHANGED
@@ -117,16 +117,17 @@ async def process_audio_input(
|
|
117 |
):
|
118 |
if event.type == FishE2EEventType.USER_CODES:
|
119 |
append_to_chat_ctx(ServeVQPart(codes=event.vq_codes), role="user")
|
120 |
-
|
121 |
elif event.type == FishE2EEventType.SPEECH_SEGMENT:
|
|
|
|
|
122 |
append_to_chat_ctx(ServeVQPart(codes=event.vq_codes))
|
123 |
-
yield state.get_history(),
|
124 |
-
|
125 |
elif event.type == FishE2EEventType.TEXT_SEGMENT:
|
126 |
append_to_chat_ctx(ServeTextPart(text=event.text))
|
127 |
-
yield state.get_history(),
|
|
|
|
|
128 |
|
129 |
-
yield state.get_history(), None, None, None
|
130 |
|
131 |
|
132 |
async def process_text_input(
|
@@ -186,9 +187,7 @@ def create_demo():
|
|
186 |
|
187 |
output_audio = gr.Audio(
|
188 |
label="Assistant's Voice",
|
189 |
-
|
190 |
-
autoplay=True,
|
191 |
-
interactive=False,
|
192 |
)
|
193 |
|
194 |
send_button = gr.Button("Send", variant="primary")
|
|
|
117 |
):
|
118 |
if event.type == FishE2EEventType.USER_CODES:
|
119 |
append_to_chat_ctx(ServeVQPart(codes=event.vq_codes), role="user")
|
|
|
120 |
elif event.type == FishE2EEventType.SPEECH_SEGMENT:
|
121 |
+
np_audio = np.frombuffer(event.frame.data, dtype=np.int16)
|
122 |
+
result_audio += np_audio
|
123 |
append_to_chat_ctx(ServeVQPart(codes=event.vq_codes))
|
124 |
+
yield state.get_history(), (44100, result_audio), None, None
|
|
|
125 |
elif event.type == FishE2EEventType.TEXT_SEGMENT:
|
126 |
append_to_chat_ctx(ServeTextPart(text=event.text))
|
127 |
+
yield state.get_history(), (44100, result_audio), None, None
|
128 |
+
|
129 |
+
yield state.get_history(), (44100, result_audio), None, None
|
130 |
|
|
|
131 |
|
132 |
|
133 |
async def process_text_input(
|
|
|
187 |
|
188 |
output_audio = gr.Audio(
|
189 |
label="Assistant's Voice",
|
190 |
+
type="numpy",
|
|
|
|
|
191 |
)
|
192 |
|
193 |
send_button = gr.Button("Send", variant="primary")
|