improve gradio display
Browse files
app.py
CHANGED
|
@@ -115,45 +115,54 @@ def cleanup_old_files():
|
|
| 115 |
file_path.unlink()
|
| 116 |
|
| 117 |
with gr.Blocks() as demo:
|
| 118 |
-
gr.
|
| 119 |
-
|
| 120 |
-
gr.Markdown(joinus)
|
| 121 |
|
| 122 |
-
with gr.
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 155 |
|
| 156 |
-
|
|
|
|
|
|
|
|
|
|
| 157 |
|
| 158 |
task_dropdown.change(
|
| 159 |
update_inputs,
|
|
|
|
| 115 |
file_path.unlink()
|
| 116 |
|
| 117 |
with gr.Blocks() as demo:
|
| 118 |
+
with gr.Row():
|
| 119 |
+
gr.Markdown(title)
|
|
|
|
| 120 |
|
| 121 |
+
with gr.Row():
|
| 122 |
+
with gr.Column(scale=1):
|
| 123 |
+
gr.Markdown(description)
|
| 124 |
+
with gr.Column(scale=1):
|
| 125 |
+
with gr.Group():
|
| 126 |
+
gr.Markdown(modelinfor)
|
| 127 |
+
gr.Markdown(joinus)
|
| 128 |
+
|
| 129 |
+
with gr.Row():
|
| 130 |
+
with gr.Column(scale=1):
|
| 131 |
+
with gr.Group():
|
| 132 |
+
image_input = gr.Image(type="filepath", label="Input Image")
|
| 133 |
+
task_dropdown = gr.Dropdown(
|
| 134 |
+
choices=[
|
| 135 |
+
"Plain Text OCR",
|
| 136 |
+
"Format Text OCR",
|
| 137 |
+
"Fine-grained OCR (Box)",
|
| 138 |
+
"Fine-grained OCR (Color)",
|
| 139 |
+
"Multi-crop OCR",
|
| 140 |
+
"Render Formatted OCR"
|
| 141 |
+
],
|
| 142 |
+
label="Select Task",
|
| 143 |
+
value="Plain Text OCR"
|
| 144 |
+
)
|
| 145 |
+
ocr_type_dropdown = gr.Dropdown(
|
| 146 |
+
choices=["ocr", "format"],
|
| 147 |
+
label="OCR Type",
|
| 148 |
+
visible=False
|
| 149 |
+
)
|
| 150 |
+
ocr_box_input = gr.Textbox(
|
| 151 |
+
label="OCR Box (x1,y1,x2,y2)",
|
| 152 |
+
placeholder="[100,100,200,200]",
|
| 153 |
+
visible=False
|
| 154 |
+
)
|
| 155 |
+
ocr_color_dropdown = gr.Dropdown(
|
| 156 |
+
choices=["red", "green", "blue"],
|
| 157 |
+
label="OCR Color",
|
| 158 |
+
visible=False
|
| 159 |
+
)
|
| 160 |
+
submit_button = gr.Button("Process")
|
| 161 |
|
| 162 |
+
with gr.Column(scale=1):
|
| 163 |
+
with gr.Group():
|
| 164 |
+
output_markdown = gr.Markdown(label="🫴🏻📸GOT-OCR")
|
| 165 |
+
output_html = gr.HTML(label="🫴🏻📸GOT-OCR")
|
| 166 |
|
| 167 |
task_dropdown.change(
|
| 168 |
update_inputs,
|