Ellie5757575757 commited on
Commit
1d2b5c4
·
verified ·
1 Parent(s): ca74a00

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -18
app.py CHANGED
@@ -1,32 +1,21 @@
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
- import gradio as gr, fastapi, gradio_client
8
- print("GRADIO_VER:", gr.__version__, "FASTAPI_VER:", fastapi.__version__, "GRADIO_CLIENT_VER:", gradio_client.__version__)
9
-
10
 
11
  def infer(file):
12
- # gr.File gives a tempfile object; if you used gr.Audio it might be a str
13
- path = getattr(file, "name", file)
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.JSON(label="Result"),
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