Rename app (2).py to app.py
Browse files- app (2).py β app.py +4 -26
app (2).py β app.py
RENAMED
@@ -105,20 +105,15 @@ def cleanup_old_files():
|
|
105 |
if current_time - file_path.stat().st_mtime > 3600: # 1 hour
|
106 |
file_path.unlink()
|
107 |
|
108 |
-
title_html = """
|
109 |
-
<h2> <span class="gradient-text" id="text">General OCR Theory</span><span class="plain-text">: Towards OCR-2.0 via a Unified End-to-end Model</span></h2>
|
110 |
-
<a href="https://huggingface.co/ucaslcl/GOT-OCR2_0">[π Hugging Face]</a>
|
111 |
-
<a href="https://arxiv.org/abs/2409.01704">[π Paper]</a>
|
112 |
-
<a href="https://github.com/Ucas-HaoranWei/GOT-OCR2.0/">[π GitHub]</a>
|
113 |
-
"""
|
114 |
|
115 |
with gr.Blocks() as demo:
|
116 |
gr.HTML(title_html)
|
117 |
gr.Markdown("""
|
118 |
-
"
|
119 |
|
120 |
-
###
|
121 |
-
You need to upload your image below and choose
|
122 |
- **plain texts OCR & format texts OCR**: The two modes are for the image-level OCR.
|
123 |
- **plain multi-crop OCR & format multi-crop OCR**: For images with more complex content, you can achieve higher-quality results with these modes.
|
124 |
- **plain fine-grained OCR & format fine-grained OCR**: 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.
|
@@ -162,23 +157,6 @@ with gr.Blocks() as demo:
|
|
162 |
with gr.Column():
|
163 |
gr.Markdown("**If you choose the mode with format, the mathpix result will be automatically rendered as follows:**")
|
164 |
html_result = gr.HTML(label="rendered html", show_label=True)
|
165 |
-
|
166 |
-
gr.Examples(
|
167 |
-
examples=[
|
168 |
-
["assets/coco.jpg", "plain texts OCR", "", "", ""],
|
169 |
-
["assets/en_30.png", "plain texts OCR", "", "", ""],
|
170 |
-
["assets/table.jpg", "format texts OCR", "", "", ""],
|
171 |
-
["assets/eq.jpg", "format texts OCR", "", "", ""],
|
172 |
-
["assets/exam.jpg", "format texts OCR", "", "", ""],
|
173 |
-
["assets/giga.jpg", "format multi-crop OCR", "", "", ""],
|
174 |
-
["assets/aff2.png", "plain fine-grained OCR", "box", "", "[409,763,756,891]"],
|
175 |
-
["assets/color.png", "plain fine-grained OCR", "color", "red", ""],
|
176 |
-
],
|
177 |
-
inputs=[image_input, task_dropdown, fine_grained_dropdown, color_dropdown, box_input],
|
178 |
-
outputs=[ocr_result, html_result],
|
179 |
-
fn=run_GOT,
|
180 |
-
label="examples",
|
181 |
-
)
|
182 |
|
183 |
task_dropdown.change(
|
184 |
task_update,
|
|
|
105 |
if current_time - file_path.stat().st_mtime > 3600: # 1 hour
|
106 |
file_path.unlink()
|
107 |
|
108 |
+
title_html = """ Bajaj """
|
|
|
|
|
|
|
|
|
|
|
109 |
|
110 |
with gr.Blocks() as demo:
|
111 |
gr.HTML(title_html)
|
112 |
gr.Markdown("""
|
113 |
+
"Demo of Bajaj OCR!!!"
|
114 |
|
115 |
+
### Guidelines
|
116 |
+
You need to upload your image below and choose your mode. More characters will result in longer wait times.
|
117 |
- **plain texts OCR & format texts OCR**: The two modes are for the image-level OCR.
|
118 |
- **plain multi-crop OCR & format multi-crop OCR**: For images with more complex content, you can achieve higher-quality results with these modes.
|
119 |
- **plain fine-grained OCR & format fine-grained OCR**: 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.
|
|
|
157 |
with gr.Column():
|
158 |
gr.Markdown("**If you choose the mode with format, the mathpix result will be automatically rendered as follows:**")
|
159 |
html_result = gr.HTML(label="rendered html", show_label=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
160 |
|
161 |
task_dropdown.change(
|
162 |
task_update,
|