Python
Hosted demo: a "Start here" row and the GPU waking on the first visit
neuregex210d620cc40c
diff --git a/web/app.css b/web/app.cssindex 4fc2d88..c7a3bc1 100644--- a/web/app.css+++ b/web/app.css@@ -575,3 +575,13 @@ dl.vals dd { margin: 0; overflow-wrap: anywhere; }.btn.flag[aria-pressed="true"] { background: var(--pink); color: #2b0716; border-color: transparent; }.fx-now { border-radius: var(--r); overflow: hidden; }.fx-now .media { aspect-ratio: 4 / 3; }++/* hosted demo: the "Start here" row on Explore */+.start5 { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-bottom: 30px; }+.start-card { display: grid; gap: 4px; padding: 0 0 12px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--panel);+ color: var(--ink); font: inherit; text-align: left; cursor: pointer; overflow: hidden; }+.start-card:hover, .start-card:focus-visible { border-color: var(--accent); }+.start-card .media { aspect-ratio: 4 / 3; overflow: hidden; margin-bottom: 6px; }+.start-card .media > img, .start-card .media > video { width: 100%; height: 100%; object-fit: cover; }+.start-card .nm { padding: 0 12px; font-weight: 600; font-size: 14.5px; }+.start-card .dim { padding: 0 12px; font-size: 12.5px; color: var(--dim); }diff --git a/web/js/catalog.js b/web/js/catalog.jsindex 081f9e4..6bdf479 100644--- a/web/js/catalog.js+++ b/web/js/catalog.js@@ -52,6 +52,8 @@ export const videoTabOf = (id) => VIDEO_TABS.find((tab) => tab.apps.includes(id)export const FEATURED = [{ id: "recast", tag: "featured" }, { id: "speak", tag: "new" }, { id: "relight", tag: null }];/** Big cards on the Explore page, in this order when they have an example. */+// the hosted demo opens with these, each loaded with its lab example: quick first, then the big video models+export const START_HERE = ["face-swap", "morph", "mixed-media", "dub", "reshoot"];export const HERO = ["effects", "recast", "motion-transfer", "speak", "camera-moves", "talking", "transitions", "vfx-day-to-night", "video-t2v", "relight", "styles"];/** Prompt-first apps get the floating composer; upload-first apps get the sidebar. */diff --git a/web/js/i18n.js b/web/js/i18n.jsindex 8e66a92..042c6a1 100644--- a/web/js/i18n.js+++ b/web/js/i18n.js@@ -14,6 +14,9 @@ const en = {"gpu.pop.ready": "Warm: runs start right away. It goes back to sleep 10 minutes after the last request.","gpu.pop.vram": "VRAM in use", "gpu.pop.loaded": "Loaded app", "gpu.pop.running": "{n} running", "gpu.pop.backend": "Backend","gpu.pop.demo": "Hosted demo: {n} of {max} runs left today (UTC).",+ "gpu.autowake": "Waking the GPU so it is ready when you press Generate.",+ "start.title": "Start here", "start.sub": "Five apps with their lab example already loaded: open one and press Generate to run it live on the GPU.",+ "start.secs": "Lab run: {s} s on {gpu}","explore.lead.a": "An open studio for", "explore.lead.b": "images, video and sound","explore.lead.text": "Every app is a ComfyUI workflow with open weights, running on your own GPU. Nothing leaves your backend.","explore.start": "Start creating", "explore.browse": "Browse apps", "explore.apps": "{n} apps",@@ -94,6 +97,9 @@ const es = {"gpu.pop.ready": "Caliente: las corridas empiezan de inmediato. Vuelve a dormir 10 minutos después de la última petición.","gpu.pop.vram": "VRAM en uso", "gpu.pop.loaded": "App cargada", "gpu.pop.running": "{n} en curso", "gpu.pop.backend": "Backend","gpu.pop.demo": "Demo en línea: quedan {n} de {max} corridas hoy (UTC).",+ "gpu.autowake": "Despertando la GPU para que esté lista cuando presiones Generar.",+ "start.title": "Empieza aquí", "start.sub": "Cinco apps con su ejemplo del lab ya cargado: abre una y presiona Generar para correrla en vivo en la GPU.",+ "start.secs": "En el lab: {s} s en {gpu}","explore.lead.a": "Un estudio abierto para", "explore.lead.b": "imagen, video y sonido","explore.lead.text": "Cada app es un workflow de ComfyUI con pesos abiertos, en tu propia GPU. Nada sale de tu backend.","explore.start": "Empieza a crear", "explore.browse": "Ver las apps", "explore.apps": "{n} apps",diff --git a/web/js/main.js b/web/js/main.jsindex f4c9843..4d0258c 100644--- a/web/js/main.js+++ b/web/js/main.js@@ -2,9 +2,9 @@// #/ Explore #/apps the app store #/app/<id> an app's workspace// #/image #/video #/audio the studios (open the last app used there)// #/library history and lab examples #/vram the VRAM map-import { el, closePopover, toast } from "./util.js";+import { el, closePopover, toast, api } from "./util.js";import { t } from "./i18n.js";-import { loadCatalog, byId, lastAppFor, studioOf, FEATURED } from "./catalog.js";+import { loadCatalog, byId, lastAppFor, studioOf, FEATURED, hosted } from "./catalog.js";import { topbar, gpuState, pollGpu } from "./nav.js";import { exploreView, appsView, libraryView, vramView } from "./views.js";import { workspaceView, recreate } from "./workspace.js";@@ -81,6 +81,21 @@ async function boot() {buildBar();window.addEventListener("hashchange", () => render());render();+ if (hosted) wakeOnce();+}++// on the hosted demo the GPU starts when someone opens the page, so it is warm by the time they press Generate+async function wakeOnce() {+ try { if (sessionStorage.getItem("ff.woke") === "1") return; } catch { /* no storage: wake every visit */ }+ try {+ const g = await api("/api/gpu");+ if (g.configured && !g.warm && !g.waking) {+ await api("/api/gpu/wake", { method: "POST" });+ toast(t("gpu.autowake"));+ pollGpu();+ }+ try { sessionStorage.setItem("ff.woke", "1"); } catch { /* fine */ }+ } catch { /* the pill still offers the button */ }}window.addEventListener("unhandledrejection", (e) => {diff --git a/web/js/views.js b/web/js/views.jsindex 11425df..1324314 100644--- a/web/js/views.js+++ b/web/js/views.js@@ -1,10 +1,10 @@// The pages that are not a workspace: Explore (home), Apps (the store), Library and the VRAM map.import { el, icon, masonry } from "./util.js";import { t } from "./i18n.js";-import { apps, byId, CATEGORIES, HERO, tagline, iconOf, fitOf, categoryOf, studioOf } from "./catalog.js";+import { apps, byId, CATEGORIES, HERO, START_HERE, hosted, tagline, iconOf, fitOf, categoryOf, studioOf } from "./catalog.js";import { exampleItem, thumb, hoverPlay, optionTile } from "./media.js";import { feed, feedView, hooks } from "./feed.js";-import { pickOption } from "./workspace.js";+import { pickOption, recreate } from "./workspace.js";import { flags, flagButton } from "./flags.js";const go = (hash) => () => { location.hash = hash; };@@ -72,7 +72,23 @@ export function exploreView() {];})).flat();+ // hosted demo: five apps one click away from a live run (their lab example goes into the form)+ const starters = hosted ? START_HERE.map((id) => byId.get(id)).filter((a) => a?.example?.full) : [];+ const start = starters.length ? [+ el("div", { class: "sec-head", style: { marginTop: "6px" } },+ el("div", {}, el("h2", { class: "display" }, t("start.title")), el("p", {}, t("start.sub")))),+ el("div", { class: "start5" }, ...starters.map((a) => {+ const item = exampleItem(a);+ const gpu = (item.gpu || "").split(",")[0].replace("NVIDIA ", "").replace(" 80GB HBM3", "");+ return el("button", { class: "start-card", type: "button", onclick: () => recreate(item) },+ thumb(item, { play: "visible" }),+ el("span", { class: "nm" }, a.name),+ el("span", { class: "dim" }, item.seconds ? t("start.secs", { s: Math.round(item.seconds), gpu: gpu || "GPU" }) : tagline(a)));+ })),+ ] : [];+const node = el("div", { class: "page" },+ ...start,hero.length ? el("div", { class: "hero-wrap" }, row, prevBtn, nextBtn) : null,el("section", { class: "promo" },el("div", { class: "promo-lead" },