Spaces:
Running
Running
Fix blank page: strip 4MB of pre-baked initial Plot values; lazy compute on first interaction
Browse files- __pycache__/app.cpython-310.pyc +0 -0
- app.py +11 -14
__pycache__/app.cpython-310.pyc
CHANGED
|
Binary files a/__pycache__/app.cpython-310.pyc and b/__pycache__/app.cpython-310.pyc differ
|
|
|
app.py
CHANGED
|
@@ -1910,7 +1910,7 @@ Three sibling ingredient embeddings from [arXiv:2605.22391](https://arxiv.org/ab
|
|
| 1910 |
label="Chem top modes", interactive=False, wrap=True)
|
| 1911 |
|
| 1912 |
with gr.Accordion("Pairwise coherence (basket members)", open=False):
|
| 1913 |
-
ex_heat = gr.Plot(
|
| 1914 |
|
| 1915 |
with gr.Accordion("Browse the mode atlas (150-200 modes per sibling)", open=False):
|
| 1916 |
with gr.Row():
|
|
@@ -1991,7 +1991,7 @@ Three sibling ingredient embeddings from [arXiv:2605.22391](https://arxiv.org/ab
|
|
| 1991 |
map_nb = gr.Checkbox(value=True, label="Show top-K neighbours")
|
| 1992 |
map_k = gr.Slider(3, 20, value=10, step=1, label="K", scale=1)
|
| 1993 |
map_btn = gr.Button("Update", variant="primary", scale=1)
|
| 1994 |
-
map_plot = gr.Plot(
|
| 1995 |
map_btn.click(umap_view, inputs=[map_sib, map_basket, map_nb, map_k, map_3d], outputs=map_plot,
|
| 1996 |
show_progress="minimal")
|
| 1997 |
|
|
@@ -2092,11 +2092,11 @@ Three sibling ingredient embeddings from [arXiv:2605.22391](https://arxiv.org/ab
|
|
| 2092 |
pp_btn = gr.Button("Generate passport", variant="primary")
|
| 2093 |
with gr.Row():
|
| 2094 |
with gr.Column(scale=3):
|
| 2095 |
-
pp_html = gr.HTML(value=
|
| 2096 |
with gr.Column(scale=1):
|
| 2097 |
gr.Markdown(f"<div style='color:{KAIKAKU_ACCENT};font-family:monospace;"
|
| 2098 |
f"font-size:0.78em;font-weight:700;letter-spacing:0.04em'>SENSORY RADAR</div>")
|
| 2099 |
-
pp_radar = gr.Plot(
|
| 2100 |
def _passport_outputs(name):
|
| 2101 |
h, r = render_passport_html(name)
|
| 2102 |
return h, r
|
|
@@ -2150,10 +2150,7 @@ Three sibling ingredient embeddings from [arXiv:2605.22391](https://arxiv.org/ab
|
|
| 2150 |
atl_show_nb = gr.Checkbox(value=True, label="Show top-K neighbours")
|
| 2151 |
atl_k = gr.Slider(3, 20, value=8, step=1, label="K")
|
| 2152 |
atl_btn = gr.Button("Update", variant="primary")
|
| 2153 |
-
atl_plot = gr.Plot(
|
| 2154 |
-
value=render_3d_atlas("chem", ["miso","basil","chocolate","tomato"], True, 8, "food group"),
|
| 2155 |
-
label="",
|
| 2156 |
-
)
|
| 2157 |
atl_btn.click(render_3d_atlas,
|
| 2158 |
inputs=[atl_sib, atl_basket, atl_show_nb, atl_k, atl_color],
|
| 2159 |
outputs=atl_plot, show_progress="minimal")
|
|
@@ -2203,7 +2200,7 @@ Three sibling ingredient embeddings from [arXiv:2605.22391](https://arxiv.org/ab
|
|
| 2203 |
value=_fp_default,
|
| 2204 |
label="Factor (preview of mode labels shown)", scale=3)
|
| 2205 |
fp_btn = gr.Button("Render", variant="primary", scale=1)
|
| 2206 |
-
fp_plot = gr.Plot(label=""
|
| 2207 |
fp_btn.click(render_factor_poster, inputs=[fp_sib, fp_factor], outputs=fp_plot, show_progress="full")
|
| 2208 |
def _refresh_factor_choices(s):
|
| 2209 |
choices = factor_options(s)
|
|
@@ -2218,7 +2215,7 @@ Three sibling ingredient embeddings from [arXiv:2605.22391](https://arxiv.org/ab
|
|
| 2218 |
cc_ings = gr.Dropdown(choices=ALL_INGREDIENTS, value=["miso","basil","cumin"],
|
| 2219 |
label="Ingredients (1-5 polygons)", multiselect=True, max_choices=5)
|
| 2220 |
cc_btn = gr.Button("Render", variant="primary")
|
| 2221 |
-
cc_plot = gr.Plot(label=""
|
| 2222 |
cc_btn.click(render_cuisine_compass, inputs=[cc_sib, cc_ings], outputs=cc_plot, show_progress="minimal")
|
| 2223 |
|
| 2224 |
# --- Arithmetic vector art ---
|
|
@@ -2228,7 +2225,7 @@ Three sibling ingredient embeddings from [arXiv:2605.22391](https://arxiv.org/ab
|
|
| 2228 |
va_pos = gr.Dropdown(choices=ALL_INGREDIENTS, value=["miso"], label="Positives", multiselect=True, max_choices=5)
|
| 2229 |
va_neg = gr.Dropdown(choices=ALL_INGREDIENTS, value=["salt"], label="Negatives", multiselect=True, max_choices=5)
|
| 2230 |
va_btn = gr.Button("Render", variant="primary")
|
| 2231 |
-
va_plot = gr.Plot(label=""
|
| 2232 |
va_btn.click(render_arithmetic_vector, inputs=[va_sib, va_pos, va_neg], outputs=va_plot, show_progress="full")
|
| 2233 |
|
| 2234 |
# --- Cuisine phylogeny ---
|
|
@@ -2236,7 +2233,7 @@ Three sibling ingredient embeddings from [arXiv:2605.22391](https://arxiv.org/ab
|
|
| 2236 |
with gr.Row():
|
| 2237 |
ph_sib = gr.Radio(choices=["cooc","core","chem"], value="chem", label="Sibling")
|
| 2238 |
ph_btn = gr.Button("Render", variant="primary")
|
| 2239 |
-
ph_plot = gr.Plot(label=""
|
| 2240 |
ph_btn.click(render_cuisine_phylogeny, inputs=[ph_sib], outputs=ph_plot, show_progress="minimal")
|
| 2241 |
|
| 2242 |
# --- Cuisine cosine map ---
|
|
@@ -2244,7 +2241,7 @@ Three sibling ingredient embeddings from [arXiv:2605.22391](https://arxiv.org/ab
|
|
| 2244 |
with gr.Row():
|
| 2245 |
cm_sib = gr.Radio(choices=["cooc","core","chem"], value="chem", label="Sibling")
|
| 2246 |
cm_btn = gr.Button("Render", variant="primary")
|
| 2247 |
-
cm_plot = gr.Plot(label=""
|
| 2248 |
cm_btn.click(render_cuisine_cosine_map, inputs=[cm_sib], outputs=cm_plot, show_progress="minimal")
|
| 2249 |
|
| 2250 |
# --- SLERP trajectory ---
|
|
@@ -2256,7 +2253,7 @@ Three sibling ingredient embeddings from [arXiv:2605.22391](https://arxiv.org/ab
|
|
| 2256 |
value="cuisine:South_Asian", label="Direction")
|
| 2257 |
st_max = gr.Slider(15, 90, value=60, step=15, label="Max θ (deg)")
|
| 2258 |
st_btn = gr.Button("Render", variant="primary")
|
| 2259 |
-
st_plot = gr.Plot(label=""
|
| 2260 |
st_btn.click(render_slerp_trajectory, inputs=[st_sib, st_seed, st_dir, st_max], outputs=st_plot, show_progress="full")
|
| 2261 |
st_sib.change(lambda s: gr.Dropdown(choices=_supervised_choices(s), value=None),
|
| 2262 |
inputs=st_sib, outputs=st_dir)
|
|
|
|
| 1910 |
label="Chem top modes", interactive=False, wrap=True)
|
| 1911 |
|
| 1912 |
with gr.Accordion("Pairwise coherence (basket members)", open=False):
|
| 1913 |
+
ex_heat = gr.Plot(label="Heatmap")
|
| 1914 |
|
| 1915 |
with gr.Accordion("Browse the mode atlas (150-200 modes per sibling)", open=False):
|
| 1916 |
with gr.Row():
|
|
|
|
| 1991 |
map_nb = gr.Checkbox(value=True, label="Show top-K neighbours")
|
| 1992 |
map_k = gr.Slider(3, 20, value=10, step=1, label="K", scale=1)
|
| 1993 |
map_btn = gr.Button("Update", variant="primary", scale=1)
|
| 1994 |
+
map_plot = gr.Plot(label="UMAP")
|
| 1995 |
map_btn.click(umap_view, inputs=[map_sib, map_basket, map_nb, map_k, map_3d], outputs=map_plot,
|
| 1996 |
show_progress="minimal")
|
| 1997 |
|
|
|
|
| 2092 |
pp_btn = gr.Button("Generate passport", variant="primary")
|
| 2093 |
with gr.Row():
|
| 2094 |
with gr.Column(scale=3):
|
| 2095 |
+
pp_html = gr.HTML(value="<div style='padding:20px;color:#64748b'>Pick an ingredient above and click <b>Generate passport</b>.</div>")
|
| 2096 |
with gr.Column(scale=1):
|
| 2097 |
gr.Markdown(f"<div style='color:{KAIKAKU_ACCENT};font-family:monospace;"
|
| 2098 |
f"font-size:0.78em;font-weight:700;letter-spacing:0.04em'>SENSORY RADAR</div>")
|
| 2099 |
+
pp_radar = gr.Plot(label="")
|
| 2100 |
def _passport_outputs(name):
|
| 2101 |
h, r = render_passport_html(name)
|
| 2102 |
return h, r
|
|
|
|
| 2150 |
atl_show_nb = gr.Checkbox(value=True, label="Show top-K neighbours")
|
| 2151 |
atl_k = gr.Slider(3, 20, value=8, step=1, label="K")
|
| 2152 |
atl_btn = gr.Button("Update", variant="primary")
|
| 2153 |
+
atl_plot = gr.Plot(label="")
|
|
|
|
|
|
|
|
|
|
| 2154 |
atl_btn.click(render_3d_atlas,
|
| 2155 |
inputs=[atl_sib, atl_basket, atl_show_nb, atl_k, atl_color],
|
| 2156 |
outputs=atl_plot, show_progress="minimal")
|
|
|
|
| 2200 |
value=_fp_default,
|
| 2201 |
label="Factor (preview of mode labels shown)", scale=3)
|
| 2202 |
fp_btn = gr.Button("Render", variant="primary", scale=1)
|
| 2203 |
+
fp_plot = gr.Plot(label="")
|
| 2204 |
fp_btn.click(render_factor_poster, inputs=[fp_sib, fp_factor], outputs=fp_plot, show_progress="full")
|
| 2205 |
def _refresh_factor_choices(s):
|
| 2206 |
choices = factor_options(s)
|
|
|
|
| 2215 |
cc_ings = gr.Dropdown(choices=ALL_INGREDIENTS, value=["miso","basil","cumin"],
|
| 2216 |
label="Ingredients (1-5 polygons)", multiselect=True, max_choices=5)
|
| 2217 |
cc_btn = gr.Button("Render", variant="primary")
|
| 2218 |
+
cc_plot = gr.Plot(label="")
|
| 2219 |
cc_btn.click(render_cuisine_compass, inputs=[cc_sib, cc_ings], outputs=cc_plot, show_progress="minimal")
|
| 2220 |
|
| 2221 |
# --- Arithmetic vector art ---
|
|
|
|
| 2225 |
va_pos = gr.Dropdown(choices=ALL_INGREDIENTS, value=["miso"], label="Positives", multiselect=True, max_choices=5)
|
| 2226 |
va_neg = gr.Dropdown(choices=ALL_INGREDIENTS, value=["salt"], label="Negatives", multiselect=True, max_choices=5)
|
| 2227 |
va_btn = gr.Button("Render", variant="primary")
|
| 2228 |
+
va_plot = gr.Plot(label="")
|
| 2229 |
va_btn.click(render_arithmetic_vector, inputs=[va_sib, va_pos, va_neg], outputs=va_plot, show_progress="full")
|
| 2230 |
|
| 2231 |
# --- Cuisine phylogeny ---
|
|
|
|
| 2233 |
with gr.Row():
|
| 2234 |
ph_sib = gr.Radio(choices=["cooc","core","chem"], value="chem", label="Sibling")
|
| 2235 |
ph_btn = gr.Button("Render", variant="primary")
|
| 2236 |
+
ph_plot = gr.Plot(label="")
|
| 2237 |
ph_btn.click(render_cuisine_phylogeny, inputs=[ph_sib], outputs=ph_plot, show_progress="minimal")
|
| 2238 |
|
| 2239 |
# --- Cuisine cosine map ---
|
|
|
|
| 2241 |
with gr.Row():
|
| 2242 |
cm_sib = gr.Radio(choices=["cooc","core","chem"], value="chem", label="Sibling")
|
| 2243 |
cm_btn = gr.Button("Render", variant="primary")
|
| 2244 |
+
cm_plot = gr.Plot(label="")
|
| 2245 |
cm_btn.click(render_cuisine_cosine_map, inputs=[cm_sib], outputs=cm_plot, show_progress="minimal")
|
| 2246 |
|
| 2247 |
# --- SLERP trajectory ---
|
|
|
|
| 2253 |
value="cuisine:South_Asian", label="Direction")
|
| 2254 |
st_max = gr.Slider(15, 90, value=60, step=15, label="Max θ (deg)")
|
| 2255 |
st_btn = gr.Button("Render", variant="primary")
|
| 2256 |
+
st_plot = gr.Plot(label="")
|
| 2257 |
st_btn.click(render_slerp_trajectory, inputs=[st_sib, st_seed, st_dir, st_max], outputs=st_plot, show_progress="full")
|
| 2258 |
st_sib.change(lambda s: gr.Dropdown(choices=_supervised_choices(s), value=None),
|
| 2259 |
inputs=st_sib, outputs=st_dir)
|