Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -465,7 +465,7 @@ def classify_crops(
|
|
| 465 |
|
| 466 |
|
| 467 |
# -----------------------------------------------------------------------------
|
| 468 |
-
# mT5 source serialization
|
| 469 |
# -----------------------------------------------------------------------------
|
| 470 |
|
| 471 |
|
|
@@ -894,18 +894,18 @@ with gr.Blocks(title="Paleo‑Hebrew Tablet Reader", css=CSS) as demo:
|
|
| 894 |
inp = gr.Image(type="pil", label="Input Image", height=IMG_HEIGHT)
|
| 895 |
|
| 896 |
with gr.Accordion("Vision Settings", open=True):
|
| 897 |
-
conf = gr.Slider(0.05, 0.95, value=0.25, step=0.01, label="
|
| 898 |
-
iou = gr.Slider(0.10, 0.90, value=0.45, step=0.01, label="
|
| 899 |
max_det = gr.Slider(1, 200, value=80, step=1, label="Max Detections")
|
| 900 |
crop_pad = gr.Slider(0.0, 0.8, value=0.20, step=0.01, label="Crop Pad")
|
| 901 |
topk_k = gr.Slider(1, 10, value=5, step=1, label="Classifier Top‑K")
|
| 902 |
|
| 903 |
with gr.Accordion("mT5 + Translation Settings", open=True):
|
| 904 |
-
rtl = gr.Checkbox(value=True, label="RTL order (right
|
| 905 |
order_mode = gr.Radio(["reading", "detector"], value="reading", label="Box order")
|
| 906 |
coord_norm = gr.Radio(["boxes", "det", "none"], value="boxes", label="coord_norm (like training)")
|
| 907 |
output_mode = gr.Radio(["he", "en_direct", "he_then_en"], value="he_then_en", label="Output mode")
|
| 908 |
-
he2en_kind = gr.Dropdown(choices=TRANSLATOR_CHOICES, value="opus", label="Hebrew
|
| 909 |
|
| 910 |
with gr.Accordion("How to run a VLM yourself (optional)", open=False):
|
| 911 |
gr.Markdown(
|
|
@@ -949,12 +949,12 @@ pred = proc.batch_decode(out, skip_special_tokens=True)[0]
|
|
| 949 |
out_dbg_pipe = gr.Code(label="Debug JSON", language="json")
|
| 950 |
out_mt5_src = gr.Textbox(label="mT5 source text (fed into mT5)", lines=10, interactive=False)
|
| 951 |
|
| 952 |
-
with gr.Tab("Detector
|
| 953 |
run_det_btn = gr.Button("Run Detector", variant="primary")
|
| 954 |
out_fig_det = gr.Plot(label="Detected Bounding Boxes")
|
| 955 |
out_json_det = gr.Code(label="Raw Detection Output", language="json")
|
| 956 |
|
| 957 |
-
with gr.Tab("Classifier
|
| 958 |
run_cls_btn = gr.Button("Run Classifier", variant="primary")
|
| 959 |
out_crops_cls = gr.Gallery(columns=8, height=360, label="Isolated Letter Crops")
|
| 960 |
out_json_cls = gr.Code(label="Top‑K per Box", language="json")
|
|
|
|
| 465 |
|
| 466 |
|
| 467 |
# -----------------------------------------------------------------------------
|
| 468 |
+
# mT5 source serialization
|
| 469 |
# -----------------------------------------------------------------------------
|
| 470 |
|
| 471 |
|
|
|
|
| 894 |
inp = gr.Image(type="pil", label="Input Image", height=IMG_HEIGHT)
|
| 895 |
|
| 896 |
with gr.Accordion("Vision Settings", open=True):
|
| 897 |
+
conf = gr.Slider(0.05, 0.95, value=0.25, step=0.01, label="Box Confidence")
|
| 898 |
+
iou = gr.Slider(0.10, 0.90, value=0.45, step=0.01, label="IoU")
|
| 899 |
max_det = gr.Slider(1, 200, value=80, step=1, label="Max Detections")
|
| 900 |
crop_pad = gr.Slider(0.0, 0.8, value=0.20, step=0.01, label="Crop Pad")
|
| 901 |
topk_k = gr.Slider(1, 10, value=5, step=1, label="Classifier Top‑K")
|
| 902 |
|
| 903 |
with gr.Accordion("mT5 + Translation Settings", open=True):
|
| 904 |
+
rtl = gr.Checkbox(value=True, label="RTL order (right to left) [for reading-order mode]")
|
| 905 |
order_mode = gr.Radio(["reading", "detector"], value="reading", label="Box order")
|
| 906 |
coord_norm = gr.Radio(["boxes", "det", "none"], value="boxes", label="coord_norm (like training)")
|
| 907 |
output_mode = gr.Radio(["he", "en_direct", "he_then_en"], value="he_then_en", label="Output mode")
|
| 908 |
+
he2en_kind = gr.Dropdown(choices=TRANSLATOR_CHOICES, value="opus", label="Hebrew to English translator")
|
| 909 |
|
| 910 |
with gr.Accordion("How to run a VLM yourself (optional)", open=False):
|
| 911 |
gr.Markdown(
|
|
|
|
| 949 |
out_dbg_pipe = gr.Code(label="Debug JSON", language="json")
|
| 950 |
out_mt5_src = gr.Textbox(label="mT5 source text (fed into mT5)", lines=10, interactive=False)
|
| 951 |
|
| 952 |
+
with gr.Tab("Detector"):
|
| 953 |
run_det_btn = gr.Button("Run Detector", variant="primary")
|
| 954 |
out_fig_det = gr.Plot(label="Detected Bounding Boxes")
|
| 955 |
out_json_det = gr.Code(label="Raw Detection Output", language="json")
|
| 956 |
|
| 957 |
+
with gr.Tab("Classifier"):
|
| 958 |
run_cls_btn = gr.Button("Run Classifier", variant="primary")
|
| 959 |
out_crops_cls = gr.Gallery(columns=8, height=360, label="Isolated Letter Crops")
|
| 960 |
out_json_cls = gr.Code(label="Top‑K per Box", language="json")
|