zliang commited on
Commit
028ddc2
1 Parent(s): 2ac0bf5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -13
app.py CHANGED
@@ -70,19 +70,28 @@ def process_pdf(pdf_file):
70
 
71
  # Create Gradio interface
72
 
73
- iface = gr.Interface(
74
- fn=process_pdf,
75
- inputs=gr.File(label="Upload a PDF"),
76
- outputs=[
77
-
78
- gr.Gallery(label="Figures from PDF", object_fit='scale-down'),
79
- gr.Gallery(label="Tables from PDF", object_fit='scale-down')
80
- ],
81
- title="PDF figures and tables extraction based on YOLOv10",
82
- description="Upload a PDF file to get figures and tables in the PDF"
83
- )
 
 
 
 
 
 
 
 
 
 
84
 
85
- # Launch the app
86
- iface.launch()
87
 
88
 
 
70
 
71
  # Create Gradio interface
72
 
73
+ with gr.Blocks() as app:
74
+ gr.Markdown(
75
+ """
76
+ # PDF Figures and Tables Extraction
77
+ Upload a PDF file to extract figures and tables using YOLOv10.
78
+ """
79
+ )
80
+
81
+ with gr.Row():
82
+ with gr.Column():
83
+ file_input = gr.File(label="Upload a PDF")
84
+ with gr.Column():
85
+ extract_button = gr.Button("Extract")
86
+
87
+ with gr.Row():
88
+ with gr.Column():
89
+ figures_gallery = gr.Gallery(label="Figures from PDF", object_fit='scale-down')
90
+ with gr.Column():
91
+ tables_gallery = gr.Gallery(label="Tables from PDF", object_fit='scale-down')
92
+
93
+ extract_button.click(process_pdf, inputs=file_input, outputs=[figures_gallery, tables_gallery])
94
 
95
+ app.launch()
 
96
 
97