AkashDataScience commited on
Commit
6f246c2
·
1 Parent(s): 3792971
Files changed (1) hide show
  1. app.py +4 -7
app.py CHANGED
@@ -14,16 +14,13 @@ 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 len(pdf_path) == 0:
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])
@@ -31,7 +28,7 @@ with gr.Blocks(theme=gr.themes.Glass()) as demo:
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
  pdf = gr.File(label="Input PDFs", file_types=[".pdf"])
19
 
20
  @gr.render(inputs=pdf)
21
  def show_slider(pdf_path):
22
+ page_count = get_pdf_page_count(pdf_path)
23
+ page_num = gr.Slider(1, page_count, value=1, step=1, label="Page", interactive=False)
 
 
 
24
 
25
  with gr.Row():
26
  clear_btn = gr.ClearButton(components=[pdf, page_num])
 
28
 
29
  submit_btn.click(inference, inputs=[pdf, page_num], outputs=ocr_out)
30
 
31
+ with gr.Row():
32
  ocr_out = gr.Textbox(label="OCR Output", type="text")
33
 
34
  demo.launch()