Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -58,7 +58,7 @@ def process_audio_input(audio):
|
|
| 58 |
return None
|
| 59 |
|
| 60 |
@spaces.GPU(duration=180) # 使用ZeroGPU,3分钟超时
|
| 61 |
-
def process_audio_text(
|
| 62 |
"""主要处理函数"""
|
| 63 |
global _MODEL_ON_CUDA, inference_model
|
| 64 |
|
|
@@ -123,23 +123,20 @@ init_model()
|
|
| 123 |
|
| 124 |
if __name__ == "__main__":
|
| 125 |
examples = [
|
| 126 |
-
["
|
| 127 |
-
["
|
| 128 |
]
|
| 129 |
|
| 130 |
iface = gr.Interface(
|
| 131 |
fn=process_audio_text,
|
| 132 |
inputs=[
|
| 133 |
-
gr.Textbox(label="Enter text instruction", value=""),
|
| 134 |
gr.Audio(type="filepath", label="Upload Audio")
|
| 135 |
],
|
| 136 |
outputs=[
|
| 137 |
-
gr.
|
| 138 |
-
gr.
|
| 139 |
],
|
| 140 |
examples=examples,
|
| 141 |
-
title="🔊 EchoX Assistant",
|
| 142 |
-
description="A multimodal AI assistant that understands speech and responds with both text and audio",
|
| 143 |
live=False,
|
| 144 |
allow_flagging="never"
|
| 145 |
)
|
|
|
|
| 58 |
return None
|
| 59 |
|
| 60 |
@spaces.GPU(duration=180) # 使用ZeroGPU,3分钟超时
|
| 61 |
+
def process_audio_text(audio):
|
| 62 |
"""主要处理函数"""
|
| 63 |
global _MODEL_ON_CUDA, inference_model
|
| 64 |
|
|
|
|
| 123 |
|
| 124 |
if __name__ == "__main__":
|
| 125 |
examples = [
|
| 126 |
+
["./show_case/1.wav"],
|
| 127 |
+
["./show_case/2.wav"],
|
| 128 |
]
|
| 129 |
|
| 130 |
iface = gr.Interface(
|
| 131 |
fn=process_audio_text,
|
| 132 |
inputs=[
|
|
|
|
| 133 |
gr.Audio(type="filepath", label="Upload Audio")
|
| 134 |
],
|
| 135 |
outputs=[
|
| 136 |
+
gr.Audio(label="Streamed Audio", streaming=True, autoplay=True),
|
| 137 |
+
gr.Textbox(label="Model output")
|
| 138 |
],
|
| 139 |
examples=examples,
|
|
|
|
|
|
|
| 140 |
live=False,
|
| 141 |
allow_flagging="never"
|
| 142 |
)
|