Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
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'
|
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:
|
|
|
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:
|