Tonic commited on
Commit
e2d189d
β€’
1 Parent(s): 61e2be7
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -45,7 +45,7 @@ model = model.eval().cuda()
45
  model.config.pad_token_id = tokenizer.eos_token_id
46
 
47
  @spaces.GPU
48
- def process_image(image, task, ocr_type=None, ocr_box=None, ocr_color=None, render=True):
49
  if task == "Plain Text OCR":
50
  res = model.chat(tokenizer, image, ocr_type='ocr', attention_mask=attention_mask)
51
  elif task == "Format Text OCR":
@@ -84,8 +84,8 @@ def update_inputs(task):
84
  elif task == "Render Formatted OCR":
85
  return [gr.update(visible=False)] * 3 + [gr.update(visible=True)]
86
 
87
- def ocr_demo(image, task, ocr_type, ocr_box, ocr_color, render):
88
- res, html_content = process_image(image, task, ocr_type, ocr_box, ocr_color, render)
89
  if html_content:
90
  return res, html_content
91
  return res, None
 
45
  model.config.pad_token_id = tokenizer.eos_token_id
46
 
47
  @spaces.GPU
48
+ def process_image(image, task, ocr_type=None, ocr_box=None, ocr_color=None, render=False):
49
  if task == "Plain Text OCR":
50
  res = model.chat(tokenizer, image, ocr_type='ocr', attention_mask=attention_mask)
51
  elif task == "Format Text OCR":
 
84
  elif task == "Render Formatted OCR":
85
  return [gr.update(visible=False)] * 3 + [gr.update(visible=True)]
86
 
87
+ def ocr_demo(image, task, ocr_type, ocr_box, ocr_color):
88
+ res, html_content = process_image(image, task, ocr_type, ocr_box, ocr_color)
89
  if html_content:
90
  return res, html_content
91
  return res, None