Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from pipeline import run_pipeline
|
| 3 |
|
| 4 |
def infer(file):
|
| 5 |
-
|
| 6 |
-
return run_pipeline(
|
| 7 |
|
| 8 |
demo = gr.Interface(
|
| 9 |
fn=infer,
|
| 10 |
-
inputs=gr.
|
| 11 |
-
outputs=gr.
|
| 12 |
title="Aphasia Classification",
|
| 13 |
-
description="
|
| 14 |
)
|
| 15 |
|
| 16 |
if __name__ == "__main__":
|
| 17 |
-
demo.
|
|
|
|
|
|
| 1 |
+
# app.py
|
| 2 |
import gradio as gr
|
| 3 |
from pipeline import run_pipeline
|
| 4 |
|
| 5 |
def infer(file):
|
| 6 |
+
path = getattr(file, "name", file) # gr.File or str
|
| 7 |
+
return run_pipeline(path, out_style="json")
|
| 8 |
|
| 9 |
demo = gr.Interface(
|
| 10 |
fn=infer,
|
| 11 |
+
inputs=gr.File(label="Upload audio/video (mp3, mp4, wav)"),
|
| 12 |
+
outputs=gr.JSON(label="Result"), # safer than Code for 4.44.0 bug
|
| 13 |
title="Aphasia Classification",
|
| 14 |
+
description="MP3/MP4 → WAV → .cha → JSON → model"
|
| 15 |
)
|
| 16 |
|
| 17 |
if __name__ == "__main__":
|
| 18 |
+
demo.queue(concurrency_count=1, max_size=8)
|
| 19 |
+
demo.launch(server_name="0.0.0.0", server_port=7860, show_error=True)
|