Tanxshh commited on
Commit
87710dc
·
verified ·
1 Parent(s): bf94d28

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -4,6 +4,7 @@ import pandas as pd
4
  from pipeline import run_pipeline # your existing pipeline.py
5
 
6
  def analyze_pdfs_gradio(files):
 
7
  with tempfile.TemporaryDirectory() as tmpdirname:
8
  for file in files:
9
  dest = os.path.join(tmpdirname, os.path.basename(file))
@@ -15,10 +16,9 @@ def analyze_pdfs_gradio(files):
15
  iface = gr.Interface(
16
  fn=analyze_pdfs_gradio,
17
  inputs=gr.File(
18
- file_types=[".pdf"],
19
- type="filepath",
20
- label="Upload PDF(s)",
21
- file_count="multiple"
22
  ),
23
  outputs=gr.Dataframe(type="pandas", label="SC API Results"),
24
  title="SC API",
@@ -26,5 +26,5 @@ iface = gr.Interface(
26
  )
27
 
28
  if __name__ == "__main__":
29
- iface.queue() # Enables /api/predict endpoint
30
  iface.launch(server_name="0.0.0.0", server_port=7860)
 
4
  from pipeline import run_pipeline # your existing pipeline.py
5
 
6
  def analyze_pdfs_gradio(files):
7
+ """Process multiple PDFs and return SC API results."""
8
  with tempfile.TemporaryDirectory() as tmpdirname:
9
  for file in files:
10
  dest = os.path.join(tmpdirname, os.path.basename(file))
 
16
  iface = gr.Interface(
17
  fn=analyze_pdfs_gradio,
18
  inputs=gr.File(
19
+ type="file",
20
+ file_count="multiple",
21
+ label="Upload PDF(s)"
 
22
  ),
23
  outputs=gr.Dataframe(type="pandas", label="SC API Results"),
24
  title="SC API",
 
26
  )
27
 
28
  if __name__ == "__main__":
29
+ iface.queue() # enables /api/predict endpoint for POST requests
30
  iface.launch(server_name="0.0.0.0", server_port=7860)