Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -301,7 +301,21 @@ def create_interface():
|
|
| 301 |
)
|
| 302 |
|
| 303 |
submit_btn = gr.Button("π Extract Data", variant="primary", size="lg")
|
| 304 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 305 |
with gr.Column(scale=3):
|
| 306 |
status_output = gr.Textbox(
|
| 307 |
label="π Status",
|
|
@@ -329,22 +343,23 @@ def create_interface():
|
|
| 329 |
- The AI will analyze visual content even if text extraction fails
|
| 330 |
""")
|
| 331 |
|
| 332 |
-
# Button action
|
| 333 |
submit_btn.click(
|
| 334 |
fn=process_documents,
|
| 335 |
inputs=[file_input],
|
| 336 |
outputs=[status_output, json_output, display_output]
|
| 337 |
)
|
| 338 |
|
| 339 |
-
#
|
| 340 |
-
|
| 341 |
-
|
| 342 |
-
|
| 343 |
-
|
| 344 |
-
|
| 345 |
-
|
|
|
|
| 346 |
)
|
| 347 |
-
|
|
|
|
| 348 |
return demo
|
| 349 |
|
| 350 |
|
|
|
|
| 301 |
)
|
| 302 |
|
| 303 |
submit_btn = gr.Button("π Extract Data", variant="primary", size="lg")
|
| 304 |
+
|
| 305 |
+
with gr.Row():
|
| 306 |
+
with gr.Column(scale=2):
|
| 307 |
+
file_input = gr.File(
|
| 308 |
+
label="π Upload Documents",
|
| 309 |
+
file_count="multiple",
|
| 310 |
+
file_types=[".pdf", ".jpg", ".jpeg", ".png", ".gif", ".bmp", ".txt", ".csv", ".doc", ".docx"]
|
| 311 |
+
)
|
| 312 |
+
|
| 313 |
+
# Add example button here
|
| 314 |
+
gr.Markdown("**Try with example:**")
|
| 315 |
+
example_btn = gr.Button("π Load Example PDF", size="sm", variant="secondary")
|
| 316 |
+
|
| 317 |
+
submit_btn = gr.Button("π Extract Data", variant="primary", size="lg")
|
| 318 |
+
|
| 319 |
with gr.Column(scale=3):
|
| 320 |
status_output = gr.Textbox(
|
| 321 |
label="π Status",
|
|
|
|
| 343 |
- The AI will analyze visual content even if text extraction fails
|
| 344 |
""")
|
| 345 |
|
|
|
|
| 346 |
submit_btn.click(
|
| 347 |
fn=process_documents,
|
| 348 |
inputs=[file_input],
|
| 349 |
outputs=[status_output, json_output, display_output]
|
| 350 |
)
|
| 351 |
|
| 352 |
+
# Example button action
|
| 353 |
+
def load_example():
|
| 354 |
+
return "example1.pdf"
|
| 355 |
+
|
| 356 |
+
example_btn.click(
|
| 357 |
+
fn=load_example,
|
| 358 |
+
inputs=None,
|
| 359 |
+
outputs=file_input
|
| 360 |
)
|
| 361 |
+
|
| 362 |
+
|
| 363 |
return demo
|
| 364 |
|
| 365 |
|