Commit ·
ac33358
1
Parent(s): 7cca175
Fixed UI issue
Browse files
ui.py
CHANGED
|
@@ -88,40 +88,37 @@ def create_interface():
|
|
| 88 |
image_input = gr.Image(label="Upload Image")
|
| 89 |
submit_btn = gr.Button("Read Document", variant="primary", size="lg")
|
| 90 |
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
|
| 110 |
with gr.Column(scale=1, min_width=400):
|
| 111 |
result_html = gr.HTML(label="Extracted Data")
|
| 112 |
raw_json = gr.JSON(label="Raw Response")
|
| 113 |
|
| 114 |
-
|
| 115 |
-
|
| 116 |
gr.update(visible=choice == "ID"),
|
| 117 |
gr.update(visible=choice == "Credit Card"),
|
| 118 |
gr.update(visible=choice == "MRZ"),
|
| 119 |
-
)
|
| 120 |
-
|
| 121 |
-
doc_type.change(
|
| 122 |
-
fn=on_type_change,
|
| 123 |
inputs=doc_type,
|
| 124 |
-
outputs=[
|
| 125 |
)
|
| 126 |
|
| 127 |
submit_btn.click(
|
|
|
|
| 88 |
image_input = gr.Image(label="Upload Image")
|
| 89 |
submit_btn = gr.Button("Read Document", variant="primary", size="lg")
|
| 90 |
|
| 91 |
+
with gr.Column(visible=True) as id_col:
|
| 92 |
+
gr.Examples(
|
| 93 |
+
examples=ID_EXAMPLES,
|
| 94 |
+
inputs=image_input,
|
| 95 |
+
label="ID Card Examples",
|
| 96 |
+
)
|
| 97 |
+
with gr.Column(visible=False) as credit_col:
|
| 98 |
+
gr.Examples(
|
| 99 |
+
examples=CREDIT_EXAMPLES,
|
| 100 |
+
inputs=image_input,
|
| 101 |
+
label="Credit Card Examples",
|
| 102 |
+
)
|
| 103 |
+
with gr.Column(visible=False) as mrz_col:
|
| 104 |
+
gr.Examples(
|
| 105 |
+
examples=MRZ_EXAMPLES,
|
| 106 |
+
inputs=image_input,
|
| 107 |
+
label="MRZ / Barcode Examples",
|
| 108 |
+
)
|
| 109 |
|
| 110 |
with gr.Column(scale=1, min_width=400):
|
| 111 |
result_html = gr.HTML(label="Extracted Data")
|
| 112 |
raw_json = gr.JSON(label="Raw Response")
|
| 113 |
|
| 114 |
+
doc_type.change(
|
| 115 |
+
fn=lambda choice: (
|
| 116 |
gr.update(visible=choice == "ID"),
|
| 117 |
gr.update(visible=choice == "Credit Card"),
|
| 118 |
gr.update(visible=choice == "MRZ"),
|
| 119 |
+
),
|
|
|
|
|
|
|
|
|
|
| 120 |
inputs=doc_type,
|
| 121 |
+
outputs=[id_col, credit_col, mrz_col],
|
| 122 |
)
|
| 123 |
|
| 124 |
submit_btn.click(
|