Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -555,6 +555,8 @@ def run(orig_image: Image.Image, points: list, preset_name: str):
|
|
| 555 |
|
| 556 |
_CSS = """
|
| 557 |
#run-btn {font-weight: 600;}
|
|
|
|
|
|
|
| 558 |
.footer-note {opacity: 0.7; font-size: 0.85rem;}
|
| 559 |
"""
|
| 560 |
|
|
@@ -586,6 +588,7 @@ with gr.Blocks(title="GazeAlign", css=_CSS) as demo:
|
|
| 586 |
label=_UPLOAD_LABEL,
|
| 587 |
file_types=[".jpg", ".jpeg", ".png", ".bmp", ".tif", ".tiff", ".webp", ".dcm"],
|
| 588 |
type="filepath",
|
|
|
|
| 589 |
)
|
| 590 |
# interactive=False β a pure display surface that reports click
|
| 591 |
# coordinates via .select (an interactive Image opens an editor
|
|
@@ -594,20 +597,10 @@ with gr.Blocks(title="GazeAlign", css=_CSS) as demo:
|
|
| 594 |
label=_FIXATION_LABEL, type="pil", interactive=False,
|
| 595 |
visible=False, height=440,
|
| 596 |
)
|
| 597 |
-
fix_status = gr.Markdown(
|
| 598 |
-
"_No fixations yet β click the image, or load a fixation file below._"
|
| 599 |
-
)
|
| 600 |
-
|
| 601 |
-
weight_slider = gr.Slider(
|
| 602 |
-
0.0, 1.0, value=0.5, step=0.05,
|
| 603 |
-
label="Dwell / duration weight for the next click",
|
| 604 |
-
)
|
| 605 |
-
with gr.Row():
|
| 606 |
-
clear_btn = gr.Button("Clear fixations")
|
| 607 |
-
delete_btn = gr.Button("Delete image", visible=False)
|
| 608 |
|
| 609 |
-
#
|
| 610 |
-
with gr.Accordion("
|
| 611 |
fixfile = gr.File(
|
| 612 |
label=_FIXFILE_LABEL, file_types=[".csv", ".xlsx", ".xls"], type="filepath"
|
| 613 |
)
|
|
@@ -618,6 +611,15 @@ with gr.Blocks(title="GazeAlign", css=_CSS) as demo:
|
|
| 618 |
time_col_dd = gr.Dropdown(label="Time column (optional)", choices=[])
|
| 619 |
apply_fix_btn = gr.Button("Apply fixation file", visible=False)
|
| 620 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 621 |
run_btn = gr.Button("Run GazeAlign", variant="primary", elem_id="run-btn")
|
| 622 |
|
| 623 |
# ββ Right: results βββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
@@ -629,7 +631,7 @@ with gr.Blocks(title="GazeAlign", css=_CSS) as demo:
|
|
| 629 |
gr.Markdown(
|
| 630 |
"<div class='footer-note'>Fixation tables use raw pixel or normalised "
|
| 631 |
"[0,1] X/Y coordinates. See the "
|
| 632 |
-
"<a href='https://github.com/
|
| 633 |
"for training and evaluation code.</div>"
|
| 634 |
)
|
| 635 |
|
|
|
|
| 555 |
|
| 556 |
_CSS = """
|
| 557 |
#run-btn {font-weight: 600;}
|
| 558 |
+
#upload-zone {min-height: 240px;}
|
| 559 |
+
#upload-zone .center {min-height: 220px;}
|
| 560 |
.footer-note {opacity: 0.7; font-size: 0.85rem;}
|
| 561 |
"""
|
| 562 |
|
|
|
|
| 588 |
label=_UPLOAD_LABEL,
|
| 589 |
file_types=[".jpg", ".jpeg", ".png", ".bmp", ".tif", ".tiff", ".webp", ".dcm"],
|
| 590 |
type="filepath",
|
| 591 |
+
elem_id="upload-zone",
|
| 592 |
)
|
| 593 |
# interactive=False β a pure display surface that reports click
|
| 594 |
# coordinates via .select (an interactive Image opens an editor
|
|
|
|
| 597 |
label=_FIXATION_LABEL, type="pil", interactive=False,
|
| 598 |
visible=False, height=440,
|
| 599 |
)
|
| 600 |
+
fix_status = gr.Markdown("")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 601 |
|
| 602 |
+
# Load-from-file menu β collapsed; click the header to reveal.
|
| 603 |
+
with gr.Accordion("π Load fixations from file", open=False):
|
| 604 |
fixfile = gr.File(
|
| 605 |
label=_FIXFILE_LABEL, file_types=[".csv", ".xlsx", ".xls"], type="filepath"
|
| 606 |
)
|
|
|
|
| 611 |
time_col_dd = gr.Dropdown(label="Time column (optional)", choices=[])
|
| 612 |
apply_fix_btn = gr.Button("Apply fixation file", visible=False)
|
| 613 |
|
| 614 |
+
# Duration weight + clear on one row (screenshot layout).
|
| 615 |
+
with gr.Row():
|
| 616 |
+
weight_slider = gr.Slider(
|
| 617 |
+
0.0, 1.0, value=1.0, step=0.05,
|
| 618 |
+
label="Fixation duration weight", scale=3,
|
| 619 |
+
)
|
| 620 |
+
clear_btn = gr.Button("β Clear fixations", scale=2)
|
| 621 |
+
delete_btn = gr.Button("Delete image", visible=False)
|
| 622 |
+
|
| 623 |
run_btn = gr.Button("Run GazeAlign", variant="primary", elem_id="run-btn")
|
| 624 |
|
| 625 |
# ββ Right: results βββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
|
|
| 631 |
gr.Markdown(
|
| 632 |
"<div class='footer-note'>Fixation tables use raw pixel or normalised "
|
| 633 |
"[0,1] X/Y coordinates. See the "
|
| 634 |
+
"<a href='https://github.com/MohammedOussamaBEN/GazeAlign'>GitHub repo</a> "
|
| 635 |
"for training and evaluation code.</div>"
|
| 636 |
)
|
| 637 |
|