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