ucaslcl commited on
Commit
1f4a8ec
·
verified ·
1 Parent(s): 112e19a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -5
app.py CHANGED
@@ -26,12 +26,11 @@ def run_GOT(image_array, got_mode, fine_grained_mode="", ocr_color="", ocr_box="
26
  elif got_mode == "format fine-grained OCR":
27
  res = model.chat(tokenizer, image, ocr_type='format', ocr_box=ocr_box, ocr_color=ocr_color, render=True, save_render_file=html_file)
28
 
29
- print("res:\n", res)
30
  if "format" in got_mode:
31
  with open(html_file, 'r') as f:
32
  demo_html = f.read()
33
- demo_html = demo_html.replace("https://cdn.jsdelivr.net/npm/[email protected]/es5/bundle.js", "assets/bundle.js")
34
- print("demo_html: \n", demo_html)
35
  print(os.path.abspath(html_file))
36
  return res, demo_html
37
  return res, None
@@ -76,6 +75,14 @@ with gr.Blocks() as demo:
76
  "🔥🔥🔥This is the official online demo of GOT-OCR-2.0 model!!!"
77
 
78
  ### Demo Guidelines
 
 
 
 
 
 
 
 
79
  """)
80
 
81
  with gr.Row():
@@ -113,8 +120,7 @@ with gr.Blocks() as demo:
113
  with gr.Column():
114
  ocr_result = gr.Textbox(label="GOT output")
115
 
116
- with gr.Column():
117
- html_show = gr.HTML(f'<a href="/home/user/app/demo.html" target="_blank">Open Demo HTML</a>')
118
  with gr.Column():
119
  html_result = gr.HTML(
120
  label="rendered html", show_label=True)
 
26
  elif got_mode == "format fine-grained OCR":
27
  res = model.chat(tokenizer, image, ocr_type='format', ocr_box=ocr_box, ocr_color=ocr_color, render=True, save_render_file=html_file)
28
 
29
+ # print("res:\n", res)
30
  if "format" in got_mode:
31
  with open(html_file, 'r') as f:
32
  demo_html = f.read()
33
+ # print("demo_html: \n", demo_html)
 
34
  print(os.path.abspath(html_file))
35
  return res, demo_html
36
  return res, None
 
75
  "🔥🔥🔥This is the official online demo of GOT-OCR-2.0 model!!!"
76
 
77
  ### Demo Guidelines
78
+
79
+ You need to upload your image below and choose one mode of GOT, then click "Submit" to run GOT model. More characters will result in longer wait times.
80
+ - **plain texts OCR & format texts OCR**
81
+ - The two modes are for the image-level OCR.
82
+ - **plain multi-crop OCR & format multi-crop OCR**
83
+ - For images with more complex content, you can achieve higher-quality results with these modes.
84
+ - **plain fine-grained OCR && format fine-grained OCR**
85
+ - In these modes, you can specify fine-grained regions on the input image for more flexible OCR. Fine-grained regions can be coordinates of the box, red color, blue color, or green color.
86
  """)
87
 
88
  with gr.Row():
 
120
  with gr.Column():
121
  ocr_result = gr.Textbox(label="GOT output")
122
 
123
+
 
124
  with gr.Column():
125
  html_result = gr.HTML(
126
  label="rendered html", show_label=True)