Spaces:
Running
Running
Commit
·
843d8b6
1
Parent(s):
c3ffdbc
Fix interface
Browse files
app.py
CHANGED
|
@@ -14,24 +14,25 @@ examples = [["data/amazon-10-k-2024.pdf"],
|
|
| 14 |
["data/goog-10-k-2023.pdf"]]
|
| 15 |
|
| 16 |
with gr.Blocks(theme=gr.themes.Glass()) as demo:
|
| 17 |
-
with gr.
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
|
|
|
| 36 |
|
| 37 |
demo.launch()
|
|
|
|
| 14 |
["data/goog-10-k-2023.pdf"]]
|
| 15 |
|
| 16 |
with gr.Blocks(theme=gr.themes.Glass()) as demo:
|
| 17 |
+
with gr.Row():
|
| 18 |
+
with gr.Column():
|
| 19 |
+
pdf = gr.File(label="Input PDFs", file_types=[".pdf"])
|
| 20 |
+
|
| 21 |
+
@gr.render(inputs=pdf)
|
| 22 |
+
def show_slider(pdf_path):
|
| 23 |
+
if pdf_path is None:
|
| 24 |
+
page_num = gr.Markdown("## No Input Provided")
|
| 25 |
+
else:
|
| 26 |
+
page_count = get_pdf_page_count(pdf_path)
|
| 27 |
+
page_num = gr.Slider(1, page_count, value=1, step=1, label="Page", interactive=False)
|
| 28 |
+
|
| 29 |
+
with gr.Row():
|
| 30 |
+
clear_btn = gr.ClearButton(components=[pdf, page_num])
|
| 31 |
+
submit_btn = gr.Button("Submit", variant='primary')
|
| 32 |
+
|
| 33 |
+
submit_btn.click(inference, inputs=[pdf, page_num], outputs=ocr_out)
|
| 34 |
+
|
| 35 |
+
with gr.Column():
|
| 36 |
+
ocr_out = gr.Textbox(label="OCR Output", type="text")
|
| 37 |
|
| 38 |
demo.launch()
|