Ankur Goyal commited on
Commit
6c169ec
1 Parent(s): 5313f01

Fix images

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -10,6 +10,7 @@ import gradio as gr
10
  import torch
11
  from docquery.pipeline import get_pipeline
12
  from docquery.document import load_bytes, load_document, ImageDocument
 
13
 
14
 
15
  def ensure_list(x):
@@ -173,10 +174,9 @@ def process_question(question, document, model=list(CHECKPOINTS.keys())[0]):
173
  def load_example_document(img, question, model):
174
  if img is not None:
175
  if question in question_files:
176
- print("using document")
177
  document = load_document(question_files[question])
178
  else:
179
- document = ImageDocument(Image.fromarray(img))
180
  preview, answer, answer_text = process_question(question, document, model)
181
  return document, question, preview, gr.update(visible=True), answer, answer_text
182
  else:
 
10
  import torch
11
  from docquery.pipeline import get_pipeline
12
  from docquery.document import load_bytes, load_document, ImageDocument
13
+ from docquery.ocr_reader import get_ocr_reader
14
 
15
 
16
  def ensure_list(x):
 
174
  def load_example_document(img, question, model):
175
  if img is not None:
176
  if question in question_files:
 
177
  document = load_document(question_files[question])
178
  else:
179
+ document = ImageDocument(Image.fromarray(img), get_ocr_reader())
180
  preview, answer, answer_text = process_question(question, document, model)
181
  return document, question, preview, gr.update(visible=True), answer, answer_text
182
  else: