Spaces:
Configuration error
Configuration error
Update app.py
Browse files
app.py
CHANGED
|
@@ -53,7 +53,8 @@ def run_GOT(image, got_mode, fine_grained_mode="", ocr_color="", ocr_box=""):
|
|
| 53 |
elif got_mode == "format fine-grained OCR":
|
| 54 |
res = model.chat(tokenizer, image_path, ocr_type='format', ocr_box=ocr_box, ocr_color=ocr_color, render=True, save_render_file=result_path)
|
| 55 |
|
| 56 |
-
res_markdown = f"$$ {res} $$"
|
|
|
|
| 57 |
|
| 58 |
if "format" in got_mode and os.path.exists(result_path):
|
| 59 |
with open(result_path, 'r') as f:
|
|
@@ -156,9 +157,10 @@ with gr.Blocks() as demo:
|
|
| 156 |
submit_button = gr.Button("Submit")
|
| 157 |
|
| 158 |
with gr.Column():
|
| 159 |
-
ocr_result = gr.
|
| 160 |
|
| 161 |
with gr.Column():
|
|
|
|
| 162 |
html_result = gr.HTML(label="rendered html", show_label=True)
|
| 163 |
|
| 164 |
gr.Examples(
|
|
|
|
| 53 |
elif got_mode == "format fine-grained OCR":
|
| 54 |
res = model.chat(tokenizer, image_path, ocr_type='format', ocr_box=ocr_box, ocr_color=ocr_color, render=True, save_render_file=result_path)
|
| 55 |
|
| 56 |
+
# res_markdown = f"$$ {res} $$"
|
| 57 |
+
res_markdown = res
|
| 58 |
|
| 59 |
if "format" in got_mode and os.path.exists(result_path):
|
| 60 |
with open(result_path, 'r') as f:
|
|
|
|
| 157 |
submit_button = gr.Button("Submit")
|
| 158 |
|
| 159 |
with gr.Column():
|
| 160 |
+
ocr_result = gr.Textbox(label="GOT output")
|
| 161 |
|
| 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(
|