Spaces:
Running
on
Zero
Running
on
Zero
improve interface logic
Browse files
app.py
CHANGED
@@ -101,28 +101,20 @@ def update_image_input(task):
|
|
101 |
|
102 |
def update_inputs(task):
|
103 |
if task in ["Plain Text OCR", "Format Text OCR", "Multi-crop OCR", "Render Formatted OCR"]:
|
104 |
-
return [gr.update(visible=False)] *
|
105 |
elif task == "Fine-grained OCR (Box)":
|
106 |
return [
|
107 |
gr.update(visible=True, choices=["ocr", "format"]),
|
108 |
gr.update(visible=True),
|
109 |
gr.update(visible=False),
|
110 |
-
gr.update(visible=False),
|
111 |
-
gr.update(visible=False),
|
112 |
-
gr.update(visible=True),
|
113 |
-
gr.update(visible=False)
|
114 |
]
|
115 |
elif task == "Fine-grained OCR (Color)":
|
116 |
return [
|
117 |
gr.update(visible=True, choices=["ocr", "format"]),
|
118 |
gr.update(visible=False),
|
119 |
gr.update(visible=True, choices=["red", "green", "blue"]),
|
120 |
-
gr.update(visible=False),
|
121 |
-
gr.update(visible=True),
|
122 |
-
gr.update(visible=False),
|
123 |
-
gr.update(visible=True)
|
124 |
]
|
125 |
-
|
126 |
def ocr_demo(image, task, ocr_type, ocr_box, ocr_color):
|
127 |
res, html_content, unique_id = process_image(image, task, ocr_type, ocr_box, ocr_color)
|
128 |
|
|
|
101 |
|
102 |
def update_inputs(task):
|
103 |
if task in ["Plain Text OCR", "Format Text OCR", "Multi-crop OCR", "Render Formatted OCR"]:
|
104 |
+
return [gr.update(visible=False)] * 3
|
105 |
elif task == "Fine-grained OCR (Box)":
|
106 |
return [
|
107 |
gr.update(visible=True, choices=["ocr", "format"]),
|
108 |
gr.update(visible=True),
|
109 |
gr.update(visible=False),
|
|
|
|
|
|
|
|
|
110 |
]
|
111 |
elif task == "Fine-grained OCR (Color)":
|
112 |
return [
|
113 |
gr.update(visible=True, choices=["ocr", "format"]),
|
114 |
gr.update(visible=False),
|
115 |
gr.update(visible=True, choices=["red", "green", "blue"]),
|
|
|
|
|
|
|
|
|
116 |
]
|
117 |
+
|
118 |
def ocr_demo(image, task, ocr_type, ocr_box, ocr_color):
|
119 |
res, html_content, unique_id = process_image(image, task, ocr_type, ocr_box, ocr_color)
|
120 |
|