ucaslcl commited on
Commit
8e0e6ba
·
verified ·
1 Parent(s): 7ea24ba

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -15,18 +15,18 @@ def run_GOT(image_array, got_mode, ocr_box="", ocr_color=""):
15
  # image = Image.fromarray(np.uint8(image_array))
16
  image = image_array
17
  if got_mode == "plain texts OCR":
18
- res = model.chat(tokenizer, image, ocr_type='ocr', gradio_input=False)
19
  elif got_mode == "format texts OCR":
20
- res = model.chat(tokenizer, image, ocr_type='format', render=True, save_render_file='./demo.html', gradio_input=True)
21
  elif got_mode == "plain multi-crop OCR":
22
- res = model.chat_crop(tokenizer, image, ocr_type='ocr', gradio_input=True)
23
  elif got_mode == "format multi-crop OCR":
24
- res = model.chat_crop(tokenizer, image, ocr_type='format', render=True, save_render_file='./demo.html', gradio_input=True)
25
 
26
  elif got_mode == "plain fine-grained OCR":
27
- res = model.chat(tokenizer, image, ocr_type='ocr', ocr_box=ocr_box, ocr_color=ocr_color, gradio_input=True)
28
  elif got_mode == "format fine-grained OCR":
29
- res = model.chat(tokenizer, image, ocr_type='format', ocr_box=ocr_box, ocr_color=ocr_color, render=True, save_render_file='./demo.html', gradio_input=True)
30
 
31
  if "format" in got_mode:
32
  with open('./demo.html', 'r') as f:
 
15
  # image = Image.fromarray(np.uint8(image_array))
16
  image = image_array
17
  if got_mode == "plain texts OCR":
18
+ res = model.chat(tokenizer, image, ocr_type='ocr')
19
  elif got_mode == "format texts OCR":
20
+ res = model.chat(tokenizer, image, ocr_type='format', render=True, save_render_file='./demo.html')
21
  elif got_mode == "plain multi-crop OCR":
22
+ res = model.chat_crop(tokenizer, image, ocr_type='ocr')
23
  elif got_mode == "format multi-crop OCR":
24
+ res = model.chat_crop(tokenizer, image, ocr_type='format', render=True, save_render_file='./demo.html')
25
 
26
  elif got_mode == "plain fine-grained OCR":
27
+ res = model.chat(tokenizer, image, ocr_type='ocr', ocr_box=ocr_box, ocr_color=ocr_color)
28
  elif got_mode == "format fine-grained OCR":
29
+ res = model.chat(tokenizer, image, ocr_type='format', ocr_box=ocr_box, ocr_color=ocr_color, render=True, save_render_file='./demo.html')
30
 
31
  if "format" in got_mode:
32
  with open('./demo.html', 'r') as f: