Ellie5757575757 commited on
Commit
e87c252
·
verified ·
1 Parent(s): f1c1219

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -6
app.py CHANGED
@@ -1,19 +1,28 @@
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)
 
 
 
 
 
1
+ import os
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
 
8
  def infer(file):
9
+ # gr.File gives a tempfile object; if you used gr.Audio it might be a str
10
+ path = getattr(file, "name", file)
11
  return run_pipeline(path, out_style="json")
12
 
13
  demo = gr.Interface(
14
  fn=infer,
15
  inputs=gr.File(label="Upload audio/video (mp3, mp4, wav)"),
16
+ outputs=gr.JSON(label="Result"),
17
  title="Aphasia Classification",
18
+ description="MP3/MP4 → WAV → .cha → JSON → model",
19
+ concurrency_limit=1,
20
  )
21
 
22
  if __name__ == "__main__":
23
+ demo.launch(
24
+ server_name="0.0.0.0",
25
+ server_port=7860,
26
+ show_error=True,
27
+ max_threads=1, # be gentle on Spaces CPU
28
+ )