AkashDataScience commited on
Commit
843d8b6
·
1 Parent(s): c3ffdbc

Fix interface

Browse files
Files changed (1) hide show
  1. app.py +20 -19
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.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()
 
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()