Ellie5757575757's picture
Update app.py
fb0c811 verified
raw
history blame
971 Bytes
import os
import warnings
warnings.filterwarnings("ignore", message="pkg_resources is deprecated")
import gradio as gr
from pipeline import run_pipeline
import gradio as gr, fastapi, gradio_client
print("GRADIO_VER:", gr.__version__, "FASTAPI_VER:", fastapi.__version__, "GRADIO_CLIENT_VER:", gradio_client.__version__)
def infer(file):
# gr.File gives a tempfile object; if you used gr.Audio it might be a str
path = getattr(file, "name", file)
return run_pipeline(path, out_style="json")
demo = gr.Interface(
fn=infer,
inputs=gr.File(label="Upload audio/video (mp3, mp4, wav)"),
outputs=gr.JSON(label="Result"),
title="Aphasia Classification",
description="MP3/MP4 → WAV → .cha → JSON → model",
concurrency_limit=1,
)
if __name__ == "__main__":
demo.launch(
server_name="0.0.0.0",
server_port=7860,
show_error=True,
max_threads=1, # be gentle on Spaces CPU
share=True
)