wagner-austin
commited on
Commit
·
dbf52c3
1
Parent(s):
1c8872a
Force legacy mode for demo data, restore hidden run_grid, clarify demo label
Browse files
app.py
CHANGED
|
@@ -87,6 +87,13 @@ def score(
|
|
| 87 |
raise gr.Error("Upload BOTH training & test CSVs *or* tick the demo-data box.")
|
| 88 |
train_path, test_path = train_csv.name, test_csv.name
|
| 89 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 90 |
out_file = TMP_DIR / f"scores_{uuid4().hex}.csv"
|
| 91 |
import atexit, functools
|
| 92 |
atexit.register(functools.partial(out_file.unlink, missing_ok=True))
|
|
@@ -143,9 +150,9 @@ with gr.Blocks(title="UCI Phonotactic Calculator") as demo:
|
|
| 143 |
test_in = gr.File(label="Test CSV")
|
| 144 |
|
| 145 |
use_demo = gr.Checkbox(
|
| 146 |
-
label="Use packaged English demo data (
|
| 147 |
value=True,
|
| 148 |
-
info="
|
| 149 |
)
|
| 150 |
|
| 151 |
model_dd = gr.Dropdown(
|
|
@@ -153,11 +160,11 @@ with gr.Blocks(title="UCI Phonotactic Calculator") as demo:
|
|
| 153 |
value="ngram",
|
| 154 |
label="Model plug-in"
|
| 155 |
)
|
| 156 |
-
#
|
|
|
|
|
|
|
| 157 |
n_slider = gr.Slider(1, 4, step=1, value=2, label="n-gram order")
|
| 158 |
|
| 159 |
-
# Remove run_grid.change(...)
|
| 160 |
-
|
| 161 |
with gr.Accordion("Advanced", open=False):
|
| 162 |
filt_txt = gr.Textbox(
|
| 163 |
label="Filter (space-separated key=value …)",
|
|
|
|
| 87 |
raise gr.Error("Upload BOTH training & test CSVs *or* tick the demo-data box.")
|
| 88 |
train_path, test_path = train_csv.name, test_csv.name
|
| 89 |
|
| 90 |
+
# ------------------------------------------------------------------
|
| 91 |
+
# Legacy-mode override for demo data
|
| 92 |
+
# ------------------------------------------------------------------
|
| 93 |
+
if use_demo:
|
| 94 |
+
run_full_grid = False # ignore any mischievous client-side tweak
|
| 95 |
+
model = None # guarantees legacy path (no --model)
|
| 96 |
+
|
| 97 |
out_file = TMP_DIR / f"scores_{uuid4().hex}.csv"
|
| 98 |
import atexit, functools
|
| 99 |
atexit.register(functools.partial(out_file.unlink, missing_ok=True))
|
|
|
|
| 150 |
test_in = gr.File(label="Test CSV")
|
| 151 |
|
| 152 |
use_demo = gr.Checkbox(
|
| 153 |
+
label="Use packaged English demo data (16-col legacy mode)",
|
| 154 |
value=True,
|
| 155 |
+
info="Runs the original 2018 output format. Untick and upload your own data to use any model/grid."
|
| 156 |
)
|
| 157 |
|
| 158 |
model_dd = gr.Dropdown(
|
|
|
|
| 160 |
value="ngram",
|
| 161 |
label="Model plug-in"
|
| 162 |
)
|
| 163 |
+
# Hidden checkbox keeps the variable alive for go_btn.click;
|
| 164 |
+
# power-users can un-hide it in the inspector if they want.
|
| 165 |
+
run_grid = gr.Checkbox(visible=False, value=False, label="Run full variant grid")
|
| 166 |
n_slider = gr.Slider(1, 4, step=1, value=2, label="n-gram order")
|
| 167 |
|
|
|
|
|
|
|
| 168 |
with gr.Accordion("Advanced", open=False):
|
| 169 |
filt_txt = gr.Textbox(
|
| 170 |
label="Filter (space-separated key=value …)",
|