Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -26,7 +26,6 @@ JS = r"""
|
|
| 26 |
const btn = document.getElementById("tqMenuBtn");
|
| 27 |
const menu = document.getElementById("tqMenu");
|
| 28 |
if (!canvas) return false;
|
| 29 |
-
|
| 30 |
if (btn && menu && !btn.__tq_bound) {
|
| 31 |
btn.__tq_bound = true;
|
| 32 |
btn.addEventListener("click", () => menu.classList.toggle("open"));
|
|
@@ -36,15 +35,12 @@ JS = r"""
|
|
| 36 |
}
|
| 37 |
});
|
| 38 |
}
|
| 39 |
-
|
| 40 |
const ctx = canvas.getContext("2d");
|
| 41 |
if (!ctx) return true;
|
| 42 |
-
|
| 43 |
let w = 0, h = 0;
|
| 44 |
let dpr = 1;
|
| 45 |
const stars = [];
|
| 46 |
const N = 170;
|
| 47 |
-
|
| 48 |
function resize() {
|
| 49 |
dpr = Math.max(1, window.devicePixelRatio || 1);
|
| 50 |
canvas.style.width = window.innerWidth + "px";
|
|
@@ -55,7 +51,6 @@ JS = r"""
|
|
| 55 |
w = window.innerWidth;
|
| 56 |
h = window.innerHeight;
|
| 57 |
}
|
| 58 |
-
|
| 59 |
function seed() {
|
| 60 |
stars.length = 0;
|
| 61 |
for (let i = 0; i < N; i++) {
|
|
@@ -67,19 +62,15 @@ JS = r"""
|
|
| 67 |
});
|
| 68 |
}
|
| 69 |
}
|
| 70 |
-
|
| 71 |
function tick() {
|
| 72 |
ctx.clearRect(0, 0, w, h);
|
| 73 |
-
|
| 74 |
const g = ctx.createRadialGradient(w/2, h/2, 10, w/2, h/2, Math.max(w,h)/1.1);
|
| 75 |
g.addColorStop(0, "rgba(0,0,0,0)");
|
| 76 |
g.addColorStop(1, "rgba(0,0,0,0.55)");
|
| 77 |
ctx.fillStyle = g;
|
| 78 |
ctx.fillRect(0, 0, w, h);
|
| 79 |
-
|
| 80 |
ctx.globalAlpha = 0.9;
|
| 81 |
ctx.fillStyle = "rgba(255,255,255,0.75)";
|
| 82 |
-
|
| 83 |
for (const s of stars) {
|
| 84 |
s.y += s.v * (1.0 + (1.0 - s.z));
|
| 85 |
if (s.y > h + 10) { s.y = -10; s.x = Math.random() * w; }
|
|
@@ -88,10 +79,8 @@ JS = r"""
|
|
| 88 |
ctx.arc(s.x, s.y, r, 0, Math.PI * 2);
|
| 89 |
ctx.fill();
|
| 90 |
}
|
| 91 |
-
|
| 92 |
requestAnimationFrame(tick);
|
| 93 |
}
|
| 94 |
-
|
| 95 |
resize();
|
| 96 |
seed();
|
| 97 |
if (!window.__tq_resize_bound) {
|
|
@@ -102,7 +91,6 @@ JS = r"""
|
|
| 102 |
tick();
|
| 103 |
return true;
|
| 104 |
}
|
| 105 |
-
|
| 106 |
let tries = 0;
|
| 107 |
const maxTries = 30;
|
| 108 |
const timer = setInterval(() => {
|
|
@@ -270,6 +258,7 @@ Tip: start with 200 episodes. Increase only when you need cleaner trends in plot
|
|
| 270 |
</div>
|
| 271 |
"""
|
| 272 |
)
|
|
|
|
| 273 |
with gr.Column(scale=2, min_width=420):
|
| 274 |
gr.Markdown('<div class="tq-card-title">Generated artifacts</div>')
|
| 275 |
down_gallery = gr.Gallery(
|
|
@@ -277,7 +266,7 @@ Tip: start with 200 episodes. Increase only when you need cleaner trends in plot
|
|
| 277 |
columns=1,
|
| 278 |
height=240,
|
| 279 |
elem_id="down_gallery",
|
| 280 |
-
preview=
|
| 281 |
)
|
| 282 |
|
| 283 |
run_down_btn.click(
|
|
@@ -310,6 +299,7 @@ This pipeline explores stability under non-stationarity: when the world changes
|
|
| 310 |
</div>
|
| 311 |
"""
|
| 312 |
)
|
|
|
|
| 313 |
with gr.Column(scale=2, min_width=420):
|
| 314 |
gr.Markdown('<div class="tq-card-title">Generated artifacts</div>')
|
| 315 |
strange_gallery = gr.Gallery(
|
|
@@ -317,7 +307,7 @@ This pipeline explores stability under non-stationarity: when the world changes
|
|
| 317 |
columns=1,
|
| 318 |
height=240,
|
| 319 |
elem_id="strange_gallery",
|
| 320 |
-
preview=
|
| 321 |
)
|
| 322 |
|
| 323 |
run_strange_btn.click(
|
|
@@ -348,4 +338,4 @@ if __name__ == "__main__":
|
|
| 348 |
server_name="0.0.0.0",
|
| 349 |
server_port=int(os.getenv("PORT", "7860")),
|
| 350 |
show_api=False,
|
| 351 |
-
)
|
|
|
|
| 26 |
const btn = document.getElementById("tqMenuBtn");
|
| 27 |
const menu = document.getElementById("tqMenu");
|
| 28 |
if (!canvas) return false;
|
|
|
|
| 29 |
if (btn && menu && !btn.__tq_bound) {
|
| 30 |
btn.__tq_bound = true;
|
| 31 |
btn.addEventListener("click", () => menu.classList.toggle("open"));
|
|
|
|
| 35 |
}
|
| 36 |
});
|
| 37 |
}
|
|
|
|
| 38 |
const ctx = canvas.getContext("2d");
|
| 39 |
if (!ctx) return true;
|
|
|
|
| 40 |
let w = 0, h = 0;
|
| 41 |
let dpr = 1;
|
| 42 |
const stars = [];
|
| 43 |
const N = 170;
|
|
|
|
| 44 |
function resize() {
|
| 45 |
dpr = Math.max(1, window.devicePixelRatio || 1);
|
| 46 |
canvas.style.width = window.innerWidth + "px";
|
|
|
|
| 51 |
w = window.innerWidth;
|
| 52 |
h = window.innerHeight;
|
| 53 |
}
|
|
|
|
| 54 |
function seed() {
|
| 55 |
stars.length = 0;
|
| 56 |
for (let i = 0; i < N; i++) {
|
|
|
|
| 62 |
});
|
| 63 |
}
|
| 64 |
}
|
|
|
|
| 65 |
function tick() {
|
| 66 |
ctx.clearRect(0, 0, w, h);
|
|
|
|
| 67 |
const g = ctx.createRadialGradient(w/2, h/2, 10, w/2, h/2, Math.max(w,h)/1.1);
|
| 68 |
g.addColorStop(0, "rgba(0,0,0,0)");
|
| 69 |
g.addColorStop(1, "rgba(0,0,0,0.55)");
|
| 70 |
ctx.fillStyle = g;
|
| 71 |
ctx.fillRect(0, 0, w, h);
|
|
|
|
| 72 |
ctx.globalAlpha = 0.9;
|
| 73 |
ctx.fillStyle = "rgba(255,255,255,0.75)";
|
|
|
|
| 74 |
for (const s of stars) {
|
| 75 |
s.y += s.v * (1.0 + (1.0 - s.z));
|
| 76 |
if (s.y > h + 10) { s.y = -10; s.x = Math.random() * w; }
|
|
|
|
| 79 |
ctx.arc(s.x, s.y, r, 0, Math.PI * 2);
|
| 80 |
ctx.fill();
|
| 81 |
}
|
|
|
|
| 82 |
requestAnimationFrame(tick);
|
| 83 |
}
|
|
|
|
| 84 |
resize();
|
| 85 |
seed();
|
| 86 |
if (!window.__tq_resize_bound) {
|
|
|
|
| 91 |
tick();
|
| 92 |
return true;
|
| 93 |
}
|
|
|
|
| 94 |
let tries = 0;
|
| 95 |
const maxTries = 30;
|
| 96 |
const timer = setInterval(() => {
|
|
|
|
| 258 |
</div>
|
| 259 |
"""
|
| 260 |
)
|
| 261 |
+
|
| 262 |
with gr.Column(scale=2, min_width=420):
|
| 263 |
gr.Markdown('<div class="tq-card-title">Generated artifacts</div>')
|
| 264 |
down_gallery = gr.Gallery(
|
|
|
|
| 266 |
columns=1,
|
| 267 |
height=240,
|
| 268 |
elem_id="down_gallery",
|
| 269 |
+
preview=False,
|
| 270 |
)
|
| 271 |
|
| 272 |
run_down_btn.click(
|
|
|
|
| 299 |
</div>
|
| 300 |
"""
|
| 301 |
)
|
| 302 |
+
|
| 303 |
with gr.Column(scale=2, min_width=420):
|
| 304 |
gr.Markdown('<div class="tq-card-title">Generated artifacts</div>')
|
| 305 |
strange_gallery = gr.Gallery(
|
|
|
|
| 307 |
columns=1,
|
| 308 |
height=240,
|
| 309 |
elem_id="strange_gallery",
|
| 310 |
+
preview=False,
|
| 311 |
)
|
| 312 |
|
| 313 |
run_strange_btn.click(
|
|
|
|
| 338 |
server_name="0.0.0.0",
|
| 339 |
server_port=int(os.getenv("PORT", "7860")),
|
| 340 |
show_api=False,
|
| 341 |
+
)
|