Spaces:
Running
Running
Commit
·
bf6c79b
1
Parent(s):
8dc2d5d
Interface changes
Browse files
app.py
CHANGED
|
@@ -98,36 +98,41 @@ examples = [["data/amazon-10-k-2024.pdf"],
|
|
| 98 |
|
| 99 |
with gr.Blocks(theme=gr.themes.Glass()) as demo:
|
| 100 |
gr.Markdown(f"# {title}\n{description}")
|
| 101 |
-
with gr.
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
with gr.
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 131 |
|
| 132 |
examples_obj = gr.Examples(examples=examples, inputs=[pdf])
|
| 133 |
|
|
|
|
| 98 |
|
| 99 |
with gr.Blocks(theme=gr.themes.Glass()) as demo:
|
| 100 |
gr.Markdown(f"# {title}\n{description}")
|
| 101 |
+
with gr.Column():
|
| 102 |
+
pdf = gr.File(label="Input PDFs", file_types=[".pdf"])
|
| 103 |
+
|
| 104 |
+
@gr.render(inputs=pdf)
|
| 105 |
+
def show_slider(pdf_path):
|
| 106 |
+
if pdf_path is None:
|
| 107 |
+
page_num = gr.Markdown("## No Input Provided")
|
| 108 |
+
else:
|
| 109 |
+
page_count = get_pdf_page_count(pdf_path)
|
| 110 |
+
page_num = gr.Slider(1, page_count, value=1, step=1, label="Page Number")
|
| 111 |
+
|
| 112 |
+
with gr.Row():
|
| 113 |
+
clear_btn = gr.ClearButton(components=[pdf, page_num])
|
| 114 |
+
submit_btn = gr.Button("Submit", variant='primary')
|
| 115 |
+
|
| 116 |
+
submit_btn.click(get_page_image, inputs=[pdf, page_num], outputs=[original, original_runtime]).then(
|
| 117 |
+
get_docling_ocr, inputs=[pdf, page_num], outputs=[docling_ocr_out, docling_ocr_runtime]).then(
|
| 118 |
+
get_paddle_ocr, inputs=[pdf, page_num], outputs=[paddle_ocr_out, paddle_ocr_runtime]).then(
|
| 119 |
+
get_smoldocling_ocr, inputs=[pdf, page_num], outputs=[smoldocling_ocr_out, smoldocling_ocr_runtime])
|
| 120 |
+
|
| 121 |
+
with gr.Column():
|
| 122 |
+
with gr.Row():
|
| 123 |
+
with gr.Column():
|
| 124 |
+
original = gr.Image(width=640, height=640, label="Original Page", interactive=False)
|
| 125 |
+
original_runtime = gr.Textbox(label="Image Extraction Time", type="text", interactive=False)
|
| 126 |
+
with gr.Column():
|
| 127 |
+
docling_ocr_out = gr.Textbox(label="Docling OCR Output", type="text", interactive=False)
|
| 128 |
+
docling_ocr_runtime = gr.Textbox(label="Docling OCR Time", type="text", interactive=False)
|
| 129 |
+
with gr.Row():
|
| 130 |
+
with gr.Column():
|
| 131 |
+
paddle_ocr_out = gr.Textbox(label="Paddle OCR Output", type="text", interactive=False)
|
| 132 |
+
paddle_ocr_runtime = gr.Textbox(label="Paddle OCR Time", type="text", interactive=False)
|
| 133 |
+
with gr.Column():
|
| 134 |
+
smoldocling_ocr_out = gr.Textbox(label="SmolDocling OCR Output", type="text", interactive=False)
|
| 135 |
+
smoldocling_ocr_runtime = gr.Textbox(label="SmolDocling OCR Time", type="text", interactive=False)
|
| 136 |
|
| 137 |
examples_obj = gr.Examples(examples=examples, inputs=[pdf])
|
| 138 |
|