Spaces:
Running
Running
improve interface logic
Browse files
app.py
CHANGED
|
@@ -101,18 +101,34 @@ 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 [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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):
|
|
|
|
| 101 |
|
| 102 |
def update_inputs(task):
|
| 103 |
if task in ["Plain Text OCR", "Format Text OCR", "Multi-crop OCR", "Render Formatted OCR"]:
|
| 104 |
+
return [
|
| 105 |
+
gr.update(visible=False),
|
| 106 |
+
gr.update(visible=False),
|
| 107 |
+
gr.update(visible=False),
|
| 108 |
+
gr.update(visible=True),
|
| 109 |
+
gr.update(visible=False),
|
| 110 |
+
gr.update(visible=True),
|
| 111 |
+
gr.update(visible=False)
|
| 112 |
+
]
|
| 113 |
elif task == "Fine-grained OCR (Box)":
|
| 114 |
return [
|
| 115 |
gr.update(visible=True, choices=["ocr", "format"]),
|
| 116 |
gr.update(visible=True),
|
| 117 |
gr.update(visible=False),
|
| 118 |
+
gr.update(visible=True),
|
| 119 |
+
gr.update(visible=False),
|
| 120 |
+
gr.update(visible=True),
|
| 121 |
+
gr.update(visible=False)
|
| 122 |
]
|
| 123 |
elif task == "Fine-grained OCR (Color)":
|
| 124 |
return [
|
| 125 |
gr.update(visible=True, choices=["ocr", "format"]),
|
| 126 |
gr.update(visible=False),
|
| 127 |
gr.update(visible=True, choices=["red", "green", "blue"]),
|
| 128 |
+
gr.update(visible=False),
|
| 129 |
+
gr.update(visible=True),
|
| 130 |
+
gr.update(visible=False),
|
| 131 |
+
gr.update(visible=True)
|
| 132 |
]
|
| 133 |
|
| 134 |
def ocr_demo(image, task, ocr_type, ocr_box, ocr_color):
|