Mageia commited on
Commit
6f13504
1 Parent(s): 65cf8b6

fix: process pdf once

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -166,9 +166,9 @@ with gr.Blocks() as demo:
166
 
167
  def select_image(evt: gr.SelectData, gallery):
168
  selected = gallery[evt.index]
169
- return selected, selected
170
 
171
- image_gallery.select(select_image, image_gallery, [selected_image, preview_image])
172
  convert_button.click(convert_pdf_to_images, inputs=[pdf_input], outputs=[gr.Textbox(visible=False), image_gallery])
173
  ocr_button.click(ocr_process, inputs=[selected_image, got_mode, ocr_color, ocr_box], outputs=ocr_output)
174
 
 
166
 
167
  def select_image(evt: gr.SelectData, gallery):
168
  selected = gallery[evt.index]
169
+ return selected
170
 
171
+ image_gallery.select(select_image, image_gallery, selected_image)
172
  convert_button.click(convert_pdf_to_images, inputs=[pdf_input], outputs=[gr.Textbox(visible=False), image_gallery])
173
  ocr_button.click(ocr_process, inputs=[selected_image, got_mode, ocr_color, ocr_box], outputs=ocr_output)
174