Spaces:
Running
Running
mohakkapoor4
commited on
Commit
·
0c158d9
1
Parent(s):
de40c22
Update UI elements for CAPTCHA OCR: adjust header, center align textboxes, and add fixed height for CAPTCHA image display.
Browse files
app.py
CHANGED
|
@@ -64,7 +64,7 @@ def ui_solve(path_hint: str, ground_truth: str):
|
|
| 64 |
return "0%", "No image generated yet. Click Generate CAPTCHA first."
|
| 65 |
|
| 66 |
with gr.Blocks(title="CAPTCHA OCR (checkpoint)") as demo:
|
| 67 |
-
gr.Markdown("## CAPTCHA OCR
|
| 68 |
|
| 69 |
with gr.Row():
|
| 70 |
# Left column: Generate button + Solve button stacked vertically
|
|
@@ -73,16 +73,18 @@ with gr.Blocks(title="CAPTCHA OCR (checkpoint)") as demo:
|
|
| 73 |
solve_btn = gr.Button("Solve", interactive=False, variant="secondary")
|
| 74 |
|
| 75 |
# Right column: Ground Truth
|
| 76 |
-
gt_out = gr.Textbox(label="Ground Truth", interactive=False)
|
| 77 |
|
| 78 |
with gr.Row():
|
| 79 |
-
|
|
|
|
|
|
|
| 80 |
path_box = gr.Textbox(label="Internal Path", interactive=False, visible=False)
|
| 81 |
|
| 82 |
# Prediction row split into two columns
|
| 83 |
with gr.Row():
|
| 84 |
-
accuracy_out = gr.Textbox(label="Character Accuracy", interactive=False)
|
| 85 |
-
pred_out = gr.Textbox(label="Prediction", interactive=False)
|
| 86 |
|
| 87 |
# Generate: outputs image, ground truth, path, and enables Solve (green)
|
| 88 |
gen_btn.click(
|
|
|
|
| 64 |
return "0%", "No image generated yet. Click Generate CAPTCHA first."
|
| 65 |
|
| 66 |
with gr.Blocks(title="CAPTCHA OCR (checkpoint)") as demo:
|
| 67 |
+
gr.Markdown("## CAPTCHA OCR ")
|
| 68 |
|
| 69 |
with gr.Row():
|
| 70 |
# Left column: Generate button + Solve button stacked vertically
|
|
|
|
| 73 |
solve_btn = gr.Button("Solve", interactive=False, variant="secondary")
|
| 74 |
|
| 75 |
# Right column: Ground Truth
|
| 76 |
+
gt_out = gr.Textbox(label="Ground Truth", interactive=False, text_align="center")
|
| 77 |
|
| 78 |
with gr.Row():
|
| 79 |
+
# Fixed height container for the CAPTCHA image
|
| 80 |
+
with gr.Box(style={"height": "200px"}):
|
| 81 |
+
img_out = gr.Image(label="Generated CAPTCHA", type="pil")
|
| 82 |
path_box = gr.Textbox(label="Internal Path", interactive=False, visible=False)
|
| 83 |
|
| 84 |
# Prediction row split into two columns
|
| 85 |
with gr.Row():
|
| 86 |
+
accuracy_out = gr.Textbox(label="Character Accuracy", interactive=False, text_align="center")
|
| 87 |
+
pred_out = gr.Textbox(label="Prediction", interactive=False, text_align="center")
|
| 88 |
|
| 89 |
# Generate: outputs image, ground truth, path, and enables Solve (green)
|
| 90 |
gen_btn.click(
|