Spaces:
Running
Running
gpt-omni
commited on
Commit
•
10cc30a
1
Parent(s):
b7df447
update
Browse files
app.py
CHANGED
@@ -332,14 +332,29 @@ def process_audio(audio):
|
|
332 |
else:
|
333 |
return OUT_RATE, audio_data.astype(np.int16)
|
334 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
335 |
|
336 |
if __name__ == '__main__':
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
)
|
344 |
-
|
345 |
demo.launch()
|
|
|
332 |
else:
|
333 |
return OUT_RATE, audio_data.astype(np.int16)
|
334 |
|
335 |
+
|
336 |
+
# Create the Gradio interface
|
337 |
+
with gr.Blocks() as demo:
|
338 |
+
# Input component: allows users to record or upload audio
|
339 |
+
audio_input = gr.Audio(source="microphone", type="filepath", label="Record or Upload Audio")
|
340 |
+
|
341 |
+
# Output component: audio output that will automatically play
|
342 |
+
audio_output = gr.Audio(label="Processed Audio", streaming=streaming_output, autoplay=True)
|
343 |
+
|
344 |
+
# Button to trigger processing after recording/uploading
|
345 |
+
submit_btn = gr.Button("Submit")
|
346 |
+
|
347 |
+
# Functionality: When the button is clicked, process the audio and output it
|
348 |
+
submit_btn.click(fn=process_audio, inputs=audio_input, outputs=audio_output)
|
349 |
+
|
350 |
|
351 |
if __name__ == '__main__':
|
352 |
+
# demo = gr.Interface(
|
353 |
+
# process_audio,
|
354 |
+
# inputs=gr.Audio(type="filepath", label="Microphone"),
|
355 |
+
# outputs=[gr.Audio(label="Response", streaming=streaming_output, autoplay=True)],
|
356 |
+
# title="Chat Mini-Omni Demo",
|
357 |
+
# live=True,
|
358 |
+
# )
|
359 |
+
# demo.queue()
|
360 |
demo.launch()
|