sussahoo commited on
Commit
494789e
1 Parent(s): dbff755

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -11
app.py CHANGED
@@ -397,15 +397,15 @@ def postprocess_dataframes(result_tables):
397
  return res
398
 
399
 
400
- def process_image(image, pdf):
401
- if pdf:
402
- path_to_pdf = pdf.name
403
- # convert PDF to PIL images (one image by page)
404
- first_page=True # we want here only the first page as image
405
- if first_page: last_page = 1
406
- else: last_page = None
407
- imgs = pdf2image.convert_from_path(path_to_pdf, last_page=last_page)
408
- image = imgs[0]
409
  TD_THRESHOLD = 0.7
410
  TSR_THRESHOLD = 0.8
411
  padd_top = 100
@@ -470,11 +470,11 @@ examples = [["image_0.png"]]
470
 
471
  iface = gr.Interface(
472
  fn=process_image,
473
- inputs=[gr.Image(type="pil"), gr.File(label="PDF")],
474
  outputs="text",
475
  title=title,
476
  description=description,
477
  article=article,
478
  examples=examples,
479
  )
480
- iface.launch(debug=True)
 
397
  return res
398
 
399
 
400
+ def process_image(image):
401
+ # if pdf:
402
+ # path_to_pdf = pdf.name
403
+ # # convert PDF to PIL images (one image by page)
404
+ # first_page=True # we want here only the first page as image
405
+ # if first_page: last_page = 1
406
+ # else: last_page = None
407
+ # imgs = pdf2image.convert_from_path(path_to_pdf, last_page=last_page)
408
+ # image = imgs[0]
409
  TD_THRESHOLD = 0.7
410
  TSR_THRESHOLD = 0.8
411
  padd_top = 100
 
470
 
471
  iface = gr.Interface(
472
  fn=process_image,
473
+ inputs=gr.Image(type="pil"),
474
  outputs="text",
475
  title=title,
476
  description=description,
477
  article=article,
478
  examples=examples,
479
  )
480
+ iface.launch(debug=False)