Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,32 +1,21 @@
|
|
| 1 |
-
import
|
| 2 |
-
import warnings
|
| 3 |
-
warnings.filterwarnings("ignore", message="pkg_resources is deprecated")
|
| 4 |
-
|
| 5 |
import gradio as gr
|
| 6 |
from pipeline import run_pipeline
|
| 7 |
-
import
|
| 8 |
-
print("
|
| 9 |
-
|
| 10 |
|
| 11 |
def infer(file):
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
return run_pipeline(path, out_style="json")
|
| 15 |
|
| 16 |
demo = gr.Interface(
|
| 17 |
fn=infer,
|
| 18 |
inputs=gr.File(label="Upload audio/video (mp3, mp4, wav)"),
|
| 19 |
-
outputs=gr.
|
| 20 |
title="Aphasia Classification",
|
| 21 |
description="MP3/MP4 → WAV → .cha → JSON → model",
|
| 22 |
concurrency_limit=1,
|
| 23 |
)
|
| 24 |
|
| 25 |
if __name__ == "__main__":
|
| 26 |
-
demo.launch(
|
| 27 |
-
server_name="0.0.0.0",
|
| 28 |
-
server_port=7860,
|
| 29 |
-
show_error=True,
|
| 30 |
-
max_threads=1, # be gentle on Spaces CPU
|
| 31 |
-
share=True
|
| 32 |
-
)
|
|
|
|
| 1 |
+
import warnings; warnings.filterwarnings("ignore", message="pkg_resources is deprecated")
|
|
|
|
|
|
|
|
|
|
| 2 |
import gradio as gr
|
| 3 |
from pipeline import run_pipeline
|
| 4 |
+
import gradio_client, fastapi
|
| 5 |
+
print("VERSIONS -> gradio:", gr.__version__, "gradio_client:", gradio_client.__version__, "fastapi:", fastapi.__version__)
|
|
|
|
| 6 |
|
| 7 |
def infer(file):
|
| 8 |
+
path = getattr(file, "name", file) # gr.File gives a tempfile
|
| 9 |
+
return run_pipeline(path, out_style="json") # returns JSON string
|
|
|
|
| 10 |
|
| 11 |
demo = gr.Interface(
|
| 12 |
fn=infer,
|
| 13 |
inputs=gr.File(label="Upload audio/video (mp3, mp4, wav)"),
|
| 14 |
+
outputs=gr.Textbox(label="Result (JSON text)"), # ← was gr.JSON; use Textbox
|
| 15 |
title="Aphasia Classification",
|
| 16 |
description="MP3/MP4 → WAV → .cha → JSON → model",
|
| 17 |
concurrency_limit=1,
|
| 18 |
)
|
| 19 |
|
| 20 |
if __name__ == "__main__":
|
| 21 |
+
demo.launch(server_name="0.0.0.0", server_port=7860, show_error=True, max_threads=1, share=True) # ← share=True
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|