Ellie5757575757 commited on
Commit
36fdb7a
·
verified ·
1 Parent(s): b90fd5d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -6
app.py CHANGED
@@ -1,17 +1,19 @@
 
1
  import gradio as gr
2
  from pipeline import run_pipeline
3
 
4
  def infer(file):
5
- # file is a tempfile-like object from Gradio
6
- return run_pipeline(file.name, out_style="json")
7
 
8
  demo = gr.Interface(
9
  fn=infer,
10
- inputs=gr.Audio(sources=["upload", "microphone"], type="filepath"), # accepts mp3/mp4/wav; ffmpeg handles it
11
- outputs=gr.Code(label="Result (JSON)"),
12
  title="Aphasia Classification",
13
- description="Upload audio/video; pipeline: ffmpeg → .cha → JSON → model → result."
14
  )
15
 
16
  if __name__ == "__main__":
17
- demo.launch()
 
 
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)