Spaces:
Running on Zero
Running on Zero
Download studio.html from akhaliq/FastFrames-L: direct link, hf CLI and curl.
- Browser
- Download file 35 kB
-
https://huggingface.co/spaces/akhaliq/FastFrames-L/resolve/main/studio.html
- Command line
-
hf download hf://spaces/akhaliq/FastFrames-L/studio.html
-
curl -L -o studio.html https://huggingface.co/spaces/akhaliq/FastFrames-L/resolve/main/studio.html
35 kB
| <html lang="en" data-theme="light"> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1"> | |
| <meta name="theme-color" content="#f5f5f7"> | |
| <title>FastFrames Studio</title> | |
| <style> | |
| :root { | |
| color-scheme: light; | |
| --bg: #f5f5f7; | |
| --surface: rgba(255,255,255,.78); | |
| --surface-solid: #ffffff; | |
| --surface-soft: rgba(0,0,0,.035); | |
| --text: #1d1d1f; | |
| --secondary: #6e6e73; | |
| --tertiary: #86868b; | |
| --border: rgba(0,0,0,.08); | |
| --accent: #0071e3; | |
| --accent-hover: #0077ed; | |
| --accent-soft: rgba(0,113,227,.10); | |
| --success: #30a46c; | |
| --shadow: 0 18px 55px rgba(0,0,0,.065); | |
| --blur: saturate(180%) blur(24px); | |
| } | |
| html[data-theme="dark"] { | |
| color-scheme: dark; | |
| --bg: #000000; | |
| --surface: rgba(28,28,30,.80); | |
| --surface-solid: #1c1c1e; | |
| --surface-soft: rgba(255,255,255,.065); | |
| --text: #f5f5f7; | |
| --secondary: #a1a1a6; | |
| --tertiary: #86868b; | |
| --border: rgba(255,255,255,.11); | |
| --accent: #0a84ff; | |
| --accent-hover: #409cff; | |
| --accent-soft: rgba(10,132,255,.16); | |
| --success: #30d158; | |
| --shadow: 0 22px 65px rgba(0,0,0,.38); | |
| } | |
| * { box-sizing: border-box; margin: 0; padding: 0; } | |
| [hidden] { display: none ; } | |
| body { | |
| min-height: 100vh; | |
| background: | |
| radial-gradient(ellipse 70% 45% at 50% -12%, var(--accent-soft), transparent 70%), | |
| var(--bg); | |
| color: var(--text); | |
| font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", Arial, sans-serif; | |
| font-size: 14px; | |
| -webkit-font-smoothing: antialiased; | |
| } | |
| button, input, textarea { font: inherit; } | |
| button, a { -webkit-tap-highlight-color: transparent; } | |
| button { color: inherit; } | |
| a { color: inherit; } | |
| .topbar { | |
| position: sticky; | |
| top: 0; | |
| z-index: 30; | |
| height: 64px; | |
| display: flex; | |
| align-items: center; | |
| gap: 24px; | |
| padding: 0 28px; | |
| background: var(--surface); | |
| backdrop-filter: var(--blur); | |
| -webkit-backdrop-filter: var(--blur); | |
| border-bottom: 1px solid var(--border); | |
| } | |
| .brand { display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 650; letter-spacing: -.025em; white-space: nowrap; } | |
| .brand-mark { | |
| width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; | |
| color: white; background: linear-gradient(145deg, #36a3ff, #0068d7); | |
| box-shadow: inset 0 1px rgba(255,255,255,.3), 0 5px 14px rgba(0,113,227,.24); | |
| } | |
| .brand-mark svg { width: 18px; height: 18px; } | |
| .studio-label { color: var(--secondary); font-weight: 450; } | |
| .tabs { display: flex; gap: 4px; padding: 3px; border-radius: 11px; background: var(--surface-soft); } | |
| .tab { | |
| border: 0; border-radius: 8px; padding: 7px 15px; background: transparent; | |
| color: var(--secondary); font-size: 13px; font-weight: 550; cursor: pointer; | |
| } | |
| .tab.active { color: var(--text); background: var(--surface-solid); box-shadow: 0 1px 5px rgba(0,0,0,.09); } | |
| .top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; } | |
| .text-link { color: var(--secondary); text-decoration: none; font-size: 13px; padding: 8px; } | |
| .text-link:hover { color: var(--accent); } | |
| .ml-intern-badge, .build-app-badge { | |
| height: 34px; display: inline-flex; align-items: center; justify-content: center; | |
| border-radius: 999px; white-space: nowrap; text-decoration: none; | |
| } | |
| .ml-intern-badge { padding: 4px 9px; background: var(--surface-soft); border: 1px solid var(--border); } | |
| .ml-intern-badge:hover, .build-app-badge:hover { border-color: var(--accent); } | |
| .ml-intern-badge img { display: block; height: 21px; width: auto; } | |
| .build-app-badge { | |
| gap: 6px; padding: 0 13px; border: 1px solid transparent; | |
| background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 600; | |
| } | |
| .icon-button { | |
| width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; | |
| border: 0; background: transparent; color: var(--secondary); cursor: pointer; | |
| } | |
| .icon-button:hover { background: var(--surface-soft); color: var(--text); } | |
| .icon-button svg { width: 19px; height: 19px; } | |
| .workspace { | |
| width: min(1500px, 100%); | |
| margin: 0 auto; | |
| padding: 28px; | |
| display: grid; | |
| grid-template-columns: minmax(0, 1fr) 350px; | |
| gap: 24px; | |
| align-items: start; | |
| } | |
| .canvas-column { min-width: 0; } | |
| .hero { padding: 8px 4px 24px; display: flex; align-items: end; justify-content: space-between; gap: 20px; } | |
| .eyebrow { color: var(--accent); font-size: 12px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 7px; } | |
| h1 { font-size: clamp(28px, 3vw, 42px); line-height: 1.06; letter-spacing: -.045em; font-weight: 680; } | |
| .hero p { margin-top: 8px; color: var(--secondary); font-size: 15px; line-height: 1.45; } | |
| .model-chip { | |
| flex-shrink: 0; padding: 8px 12px; border: 1px solid var(--border); border-radius: 999px; | |
| background: var(--surface); color: var(--secondary); font-size: 12px; text-decoration: none; | |
| } | |
| .model-chip:hover { color: var(--accent); border-color: var(--accent); } | |
| .stage-card, .inspector, .history-card { | |
| background: var(--surface); | |
| backdrop-filter: var(--blur); | |
| -webkit-backdrop-filter: var(--blur); | |
| border: 1px solid var(--border); | |
| box-shadow: var(--shadow); | |
| } | |
| .stage-card { border-radius: 26px; overflow: hidden; } | |
| .stage-header { min-height: 50px; display: flex; align-items: center; gap: 10px; padding: 10px 16px; } | |
| .stage-title { font-size: 13px; font-weight: 600; } | |
| .status-pill { | |
| display: inline-flex; align-items: center; gap: 6px; margin-left: auto; | |
| color: var(--secondary); background: var(--surface-soft); border-radius: 999px; padding: 5px 10px; font-size: 11px; | |
| } | |
| .status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--success); } | |
| .status-pill.busy .status-dot { background: var(--accent); animation: breathe 1.2s ease-in-out infinite; } | |
| @keyframes breathe { 50% { opacity: .25; transform: scale(.8); } } | |
| .video-stage { | |
| position: relative; | |
| aspect-ratio: 832 / 480; | |
| margin: 0 12px; | |
| border-radius: 18px; | |
| overflow: hidden; | |
| display: grid; | |
| place-items: center; | |
| background: #050505; | |
| } | |
| #player { width: 100%; height: 100%; object-fit: contain; background: #050505; display: block; } | |
| .empty-state { | |
| position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; | |
| padding: 30px; text-align: center; color: #f5f5f7; | |
| background: radial-gradient(ellipse at 50% 20%, #252b35, #08090b 70%); | |
| } | |
| .empty-icon { | |
| width: 58px; height: 58px; border-radius: 18px; display: grid; place-items: center; margin-bottom: 18px; | |
| color: #8fc8ff; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.10); | |
| } | |
| .empty-icon svg { width: 28px; height: 28px; } | |
| .empty-state h2 { font-size: clamp(21px, 3vw, 30px); letter-spacing: -.035em; font-weight: 620; } | |
| .empty-state p { max-width: 380px; color: #a1a1a6; margin-top: 9px; line-height: 1.5; font-size: 13px; } | |
| .loading-overlay { | |
| position: absolute; left: 16px; right: 16px; bottom: 16px; padding: 12px 14px; | |
| border-radius: 13px; color: #f5f5f7; background: rgba(15,15,17,.76); | |
| backdrop-filter: blur(16px); border: 1px solid rgba(255,255,255,.12); | |
| } | |
| .loading-line { display: flex; align-items: center; gap: 9px; font-size: 12px; } | |
| .spinner { | |
| width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.25); border-top-color: #64b5ff; | |
| border-radius: 50%; animation: spin .8s linear infinite; flex-shrink: 0; | |
| } | |
| @keyframes spin { to { transform: rotate(360deg); } } | |
| .progress-track { height: 3px; margin-top: 10px; border-radius: 3px; background: rgba(255,255,255,.15); overflow: hidden; } | |
| .progress-bar { width: 0%; height: 100%; border-radius: inherit; background: #64b5ff; transition: width .35s ease; } | |
| .transport { min-height: 62px; display: flex; align-items: center; gap: 10px; padding: 12px 16px; } | |
| .transport-meta { min-width: 0; color: var(--secondary); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } | |
| .transport-actions { margin-left: auto; display: flex; gap: 7px; flex-shrink: 0; } | |
| .small-button { | |
| border: 1px solid var(--border); border-radius: 999px; background: var(--surface-solid); | |
| color: var(--text); padding: 7px 12px; font-size: 12px; font-weight: 550; | |
| text-decoration: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; | |
| } | |
| .small-button:hover { border-color: var(--accent); color: var(--accent); } | |
| .small-button:disabled { opacity: .4; cursor: default; } | |
| .history-card { border-radius: 20px; margin-top: 20px; padding: 16px; box-shadow: none; } | |
| .section-heading { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; } | |
| .section-heading h2 { font-size: 14px; letter-spacing: -.01em; font-weight: 620; } | |
| .section-heading span { color: var(--tertiary); font-size: 12px; } | |
| .clear-button { margin-left: auto; border: 0; background: transparent; color: var(--accent); font-size: 12px; cursor: pointer; } | |
| .history-list { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; } | |
| .history-empty { grid-column: 1 / -1; color: var(--tertiary); text-align: center; padding: 18px; font-size: 12px; } | |
| .history-item { | |
| min-width: 0; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; | |
| background: var(--surface-solid); cursor: pointer; text-align: left; padding: 0; | |
| } | |
| .history-item:hover { border-color: var(--accent); } | |
| .history-item video { width: 100%; aspect-ratio: 16/9; object-fit: cover; display: block; background: #050505; pointer-events: none; } | |
| .history-caption { padding: 8px 9px; } | |
| .history-caption strong { display: block; font-size: 11px; font-weight: 600; } | |
| .history-caption span { display: block; margin-top: 3px; color: var(--tertiary); font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } | |
| .inspector { border-radius: 26px; padding: 22px; position: sticky; top: 88px; } | |
| .inspector h2 { font-size: 23px; letter-spacing: -.035em; font-weight: 660; } | |
| .inspector-subtitle { color: var(--secondary); font-size: 12px; line-height: 1.45; margin: 6px 0 20px; } | |
| .field { margin-top: 18px; } | |
| .field-label { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font-size: 12px; font-weight: 600; } | |
| .field-label span { color: var(--tertiary); font-weight: 450; font-size: 11px; } | |
| textarea, input[type="number"] { | |
| width: 100%; border: 1px solid var(--border); border-radius: 13px; outline: none; | |
| background: var(--surface-soft); color: var(--text); padding: 12px 13px; | |
| transition: border-color .18s, box-shadow .18s; | |
| } | |
| textarea { min-height: 142px; resize: vertical; line-height: 1.48; font-size: 13px; } | |
| textarea::placeholder { color: var(--tertiary); } | |
| textarea:focus, input[type="number"]:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); } | |
| .examples { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; } | |
| .example-chip { | |
| border: 1px solid var(--border); border-radius: 999px; padding: 6px 9px; | |
| background: transparent; color: var(--secondary); font-size: 10px; cursor: pointer; | |
| } | |
| .example-chip:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); } | |
| .segmented { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; padding: 3px; border-radius: 11px; background: var(--surface-soft); } | |
| .segment { | |
| border: 0; border-radius: 8px; background: transparent; color: var(--secondary); | |
| padding: 8px 4px; font-size: 12px; font-weight: 550; cursor: pointer; | |
| } | |
| .segment.active { color: var(--text); background: var(--surface-solid); box-shadow: 0 1px 4px rgba(0,0,0,.08); } | |
| .seed-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: end; } | |
| .seed-row input { height: 42px; } | |
| .switch-label { display: flex; align-items: center; gap: 8px; height: 42px; color: var(--secondary); font-size: 11px; cursor: pointer; } | |
| .switch-label input { position: absolute; opacity: 0; pointer-events: none; } | |
| .switch { | |
| width: 38px; height: 23px; border-radius: 999px; background: var(--surface-soft); | |
| border: 1px solid var(--border); position: relative; transition: background .18s; | |
| } | |
| .switch::after { | |
| content: ""; position: absolute; width: 19px; height: 19px; left: 1px; top: 1px; | |
| border-radius: 50%; background: white; box-shadow: 0 1px 4px rgba(0,0,0,.25); transition: transform .18s; | |
| } | |
| .switch-label input:checked + .switch { background: #34c759; border-color: #34c759; } | |
| .switch-label input:checked + .switch::after { transform: translateX(15px); } | |
| .run-button { | |
| width: 100%; margin-top: 22px; border: 0; border-radius: 14px; padding: 13px 18px; | |
| background: var(--accent); color: white; font-size: 14px; font-weight: 600; cursor: pointer; | |
| box-shadow: 0 7px 18px rgba(0,113,227,.20); transition: background .15s, transform .1s; | |
| } | |
| .run-button:hover { background: var(--accent-hover); } | |
| .run-button:active { transform: scale(.985); } | |
| .run-button.stop { background: #ff453a; box-shadow: none; } | |
| .privacy-note { margin-top: 11px; text-align: center; color: var(--tertiary); font-size: 10px; line-height: 1.45; } | |
| .spec-card { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; } | |
| .spec { text-align: center; } | |
| .spec strong { display: block; font-size: 13px; font-weight: 620; } | |
| .spec span { display: block; color: var(--tertiary); margin-top: 3px; font-size: 10px; } | |
| .workflow-main { width: 100%; height: calc(100vh - 64px); padding: 16px; } | |
| .workflow-main iframe { width: 100%; height: 100%; border: 0; border-radius: 20px; background: var(--surface-solid); } | |
| .statusbar { | |
| position: fixed; z-index: 20; left: 50%; bottom: 18px; transform: translateX(-50%); | |
| max-width: min(680px, calc(100vw - 32px)); display: flex; align-items: center; gap: 9px; | |
| padding: 10px 16px; border: 1px solid var(--border); border-radius: 999px; | |
| background: var(--surface); backdrop-filter: var(--blur); box-shadow: var(--shadow); | |
| color: var(--secondary); font-size: 12px; pointer-events: none; | |
| opacity: 0; transition: opacity .2s, transform .2s; | |
| } | |
| .statusbar.visible { opacity: 1; transform: translateX(-50%) translateY(-4px); } | |
| .statusbar.error { color: #ff453a; } | |
| .license-note { padding: 0 20px 85px; text-align: center; color: var(--tertiary); font-size: 10px; } | |
| .license-note a { color: var(--secondary); } | |
| :focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; } | |
| @media (max-width: 1050px) { | |
| .ml-intern-badge { display: none; } | |
| .workspace { grid-template-columns: minmax(0, 1fr) 310px; padding: 20px; gap: 18px; } | |
| .history-list { grid-template-columns: repeat(3, minmax(0, 1fr)); } | |
| } | |
| @media (max-width: 820px) { | |
| .topbar { padding: 0 14px; gap: 12px; height: auto; min-height: 60px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; } | |
| .brand { font-size: 15px; } | |
| .studio-label, .text-link { display: none; } | |
| .build-app-badge { padding: 0 10px; font-size: 11px; } | |
| .top-actions { gap: 0; } | |
| .workspace { grid-template-columns: 1fr; padding: 14px; } | |
| .hero { padding-top: 4px; } | |
| .model-chip { display: none; } | |
| .inspector { position: static; order: -1; } | |
| textarea { min-height: 110px; } | |
| .history-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } | |
| .workflow-main { height: calc(100vh - 100px); padding: 8px; } | |
| } | |
| @media (prefers-reduced-motion: reduce) { | |
| *, *::before, *::after { animation-duration: .01ms ; transition-duration: .01ms ; } | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <header class="topbar"> | |
| <div class="brand"> | |
| <span class="brand-mark" aria-hidden="true"> | |
| <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8"><rect x="3" y="5" width="18" height="14" rx="3"/><path d="m10 9 5 3-5 3Z" fill="currentColor" stroke="none"/></svg> | |
| </span> | |
| FastFrames <span class="studio-label">Studio</span> | |
| </div> | |
| <nav class="tabs" aria-label="Studio views"> | |
| <button class="tab active" id="create-tab">Create</button> | |
| <button class="tab" id="workflow-tab">Workflow</button> | |
| </nav> | |
| <div class="top-actions"> | |
| <a class="ml-intern-badge" href="https://hf.co/chat?mode=ml-intern" target="_blank" rel="noopener" aria-label="Built with ML Intern"> | |
| <img src="https://huggingface.co/datasets/huggingface/badges/resolve/main/built-with-ml-intern-md.svg" alt="Built with ML Intern"> | |
| </a> | |
| <a class="build-app-badge" href="https://hf.co/chat?mode=ml-intern" target="_blank" rel="noopener">Build your own app here <span aria-hidden="true">↗</span></a> | |
| <a class="text-link" href="https://huggingface.co/apple/FastFrames-L" target="_blank" rel="noopener">Model</a> | |
| <a class="text-link" href="https://arxiv.org/abs/2611.23226" target="_blank" rel="noopener">Paper</a> | |
| <button class="icon-button" id="theme-toggle" aria-label="Toggle appearance" title="Toggle appearance"> | |
| <svg id="theme-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round"><circle cx="12" cy="12" r="4"/><path d="M12 2v2M12 20v2M4.93 4.93l1.42 1.42M17.65 17.65l1.42 1.42M2 12h2M20 12h2M4.93 19.07l1.42-1.42M17.65 6.35l1.42-1.42"/></svg> | |
| </button> | |
| </div> | |
| </header> | |
| <main class="workspace" id="create-view"> | |
| <section class="canvas-column"> | |
| <div class="hero"> | |
| <div> | |
| <div class="eyebrow">Text to video, reimagined</div> | |
| <h1>Direct your next scene.</h1> | |
| <p>Five seconds of imagination, rendered frame by frame.</p> | |
| </div> | |
| <a class="model-chip" href="https://huggingface.co/apple/FastFrames-L" target="_blank" rel="noopener">FastFrames-L · 14B</a> | |
| </div> | |
| <div class="stage-card"> | |
| <div class="stage-header"> | |
| <span class="stage-title">Preview</span> | |
| <span class="status-pill" id="stage-pill"><span class="status-dot"></span><span id="stage-status">Ready</span></span> | |
| </div> | |
| <div class="video-stage"> | |
| <video id="player" playsinline preload="auto" muted hidden></video> | |
| <div class="empty-state" id="empty-state"> | |
| <div class="empty-icon"> | |
| <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M12 3v3M12 18v3M3 12h3M18 12h3M5.64 5.64l2.12 2.12M16.24 16.24l2.12 2.12M5.64 18.36l2.12-2.12M16.24 7.76l2.12-2.12"/><circle cx="12" cy="12" r="3.5"/></svg> | |
| </div> | |
| <h2>A blank canvas for motion.</h2> | |
| <p>Write a scene, choose a duration, and watch it come to life. Your preview will appear here as frames are generated.</p> | |
| </div> | |
| <div class="loading-overlay" id="loading-overlay" hidden> | |
| <div class="loading-line"><span class="spinner"></span><span id="loading-text">Preparing your scene…</span></div> | |
| <div class="progress-track"><div class="progress-bar" id="progress-bar"></div></div> | |
| </div> | |
| </div> | |
| <div class="transport"> | |
| <span class="transport-meta" id="result-meta">No render yet</span> | |
| <div class="transport-actions"> | |
| <button class="small-button" id="new-button">New scene</button> | |
| <a class="small-button" id="download-link" href="#" download="fastframes.mp4" hidden>Download</a> | |
| </div> | |
| </div> | |
| </div> | |
| <section class="history-card"> | |
| <div class="section-heading"><h2>Recent scenes</h2><span id="history-count"></span><button class="clear-button" id="clear-history">Clear</button></div> | |
| <div class="history-list" id="history-list"><div class="history-empty">Your finished scenes will be kept here for this session.</div></div> | |
| </section> | |
| </section> | |
| <aside class="inspector"> | |
| <h2>Create a scene</h2> | |
| <p class="inspector-subtitle">Describe the subject, motion, setting, and camera. FastFrames takes care of the sequence.</p> | |
| <div class="field"> | |
| <label class="field-label" for="prompt">Prompt <span id="char-count">0 / 2000</span></label> | |
| <textarea id="prompt" maxlength="2000" placeholder="A cinematic tracking shot of…">A golden retriever puppy running through tall grass in slow motion, sunlight flaring behind it, cinematic tracking shot.</textarea> | |
| <div class="examples" id="examples"></div> | |
| </div> | |
| <div class="field"> | |
| <div class="field-label">Duration <span>Up to 81 frames</span></div> | |
| <div class="segmented" id="duration-control" role="group" aria-label="Video duration"> | |
| <button class="segment" data-length="2 s">2 sec</button> | |
| <button class="segment" data-length="3 s">3 sec</button> | |
| <button class="segment" data-length="4 s">4 sec</button> | |
| <button class="segment active" data-length="5 s">5 sec</button> | |
| </div> | |
| </div> | |
| <div class="field seed-row"> | |
| <div> | |
| <label class="field-label" for="seed">Seed</label> | |
| <input id="seed" type="number" min="0" max="2147483647" step="1" value="42"> | |
| </div> | |
| <label class="switch-label"><input id="randomize" type="checkbox" checked><span class="switch"></span>Randomize</label> | |
| </div> | |
| <button class="run-button" id="run-button">Generate video</button> | |
| <p class="privacy-note">Runs on ZeroGPU xlarge. Press ⌘/Ctrl + Return to generate.<br>Research use only. No prompt history leaves this session.</p> | |
| <div class="spec-card"> | |
| <div class="spec"><strong>832 × 480</strong><span>Resolution</span></div> | |
| <div class="spec"><strong>16 fps</strong><span>Frame rate</span></div> | |
| <div class="spec"><strong>2 steps</strong><span>Per frame</span></div> | |
| </div> | |
| </aside> | |
| </main> | |
| <main class="workflow-main" id="workflow-view" hidden> | |
| <iframe id="workflow-frame" title="FastFrames workflow canvas" loading="lazy"></iframe> | |
| </main> | |
| <div class="license-note">FastFrames-L is licensed for <a href="https://huggingface.co/apple/FastFrames-L/blob/main/LICENSE" target="_blank" rel="noopener">research purposes only</a>. Generated content may be inaccurate or unexpected.</div> | |
| <div class="statusbar" id="statusbar" role="status" aria-live="polite"><span id="status-text"></span></div> | |
| <script type="module"> | |
| import { client } from "https://cdn.jsdelivr.net/npm/@gradio/client@2.7.1/dist/index.min.js"; | |
| const $ = (id) => document.getElementById(id); | |
| const state = { | |
| app: null, | |
| busy: false, | |
| cancelled: false, | |
| submission: null, | |
| length: "5 s", | |
| previewQueue: [], | |
| previewPlaying: false, | |
| finalUrl: null, | |
| history: [], | |
| statusTimer: null, | |
| }; | |
| const EXAMPLES = [ | |
| { label: "Moon garden", prompt: "A tiny astronaut tending a glowing garden inside a glass greenhouse on the moon, stars visible through the windows." }, | |
| { label: "Coastal aerial", prompt: "Aerial view of turquoise waves breaking over a black-sand beach at sunrise, sea mist drifting across the shoreline." }, | |
| { label: "Paper dragon", prompt: "A red paper dragon flying through a lantern-lit night market, ribbons fluttering, lively and richly detailed." }, | |
| { label: "After the rain", prompt: "Macro shot of raindrops falling onto a blue flower, petals trembling, shallow depth of field, soft morning light." }, | |
| ]; | |
| function mediaUrl(media) { | |
| return typeof media === "string" ? media : media?.url || media?.path || null; | |
| } | |
| function unwrapData(message) { | |
| const data = message?.data ?? message?.payload?.data; | |
| if (Array.isArray(data)) { | |
| return data.find((item) => item && typeof item === "object" && "kind" in item) ?? data[0] ?? {}; | |
| } | |
| return data ?? {}; | |
| } | |
| function notify(text, error = false, sticky = false) { | |
| clearTimeout(state.statusTimer); | |
| $("status-text").textContent = text; | |
| $("statusbar").classList.toggle("error", error); | |
| $("statusbar").classList.add("visible"); | |
| if (!sticky) { | |
| state.statusTimer = setTimeout(() => $("statusbar").classList.remove("visible"), 4500); | |
| } | |
| } | |
| function setStageStatus(text, busy = false) { | |
| $("stage-status").textContent = text; | |
| $("stage-pill").classList.toggle("busy", busy); | |
| } | |
| function setProgress(frames, total) { | |
| const percent = total ? Math.min(100, frames / total * 100) : 0; | |
| $("progress-bar").style.width = `${percent}%`; | |
| $("loading-text").textContent = frames ? `${frames} of ${total} frames rendered` : "Preparing your scene…"; | |
| } | |
| function setBusy(busy) { | |
| state.busy = busy; | |
| $("run-button").textContent = busy ? "Stop generation" : "Generate video"; | |
| $("run-button").classList.toggle("stop", busy); | |
| $("prompt").disabled = busy; | |
| $("seed").disabled = busy; | |
| $("randomize").disabled = busy; | |
| document.querySelectorAll(".segment").forEach((button) => button.disabled = busy); | |
| if (busy) setStageStatus("Rendering", true); | |
| else if ($("stage-status").textContent === "Rendering") setStageStatus("Ready"); | |
| if (!busy) state.submission = null; | |
| } | |
| function showPlayer() { | |
| $("empty-state").hidden = true; | |
| $("player").hidden = false; | |
| } | |
| function resetPreview() { | |
| state.previewQueue = []; | |
| state.previewPlaying = false; | |
| state.finalUrl = null; | |
| const player = $("player"); | |
| player.pause(); | |
| player.removeAttribute("src"); | |
| player.load(); | |
| player.hidden = true; | |
| player.controls = false; | |
| player.loop = false; | |
| player.muted = true; | |
| $("empty-state").hidden = false; | |
| $("download-link").hidden = true; | |
| $("result-meta").textContent = "No render yet"; | |
| $("progress-bar").style.width = "0%"; | |
| } | |
| async function playNextPreview() { | |
| if (state.finalUrl || state.previewPlaying || !state.previewQueue.length) return; | |
| const next = state.previewQueue.shift(); | |
| const player = $("player"); | |
| state.previewPlaying = true; | |
| showPlayer(); | |
| player.muted = true; | |
| player.controls = false; | |
| player.loop = false; | |
| player.src = next; | |
| try { | |
| await player.play(); | |
| } catch (_) { | |
| state.previewPlaying = false; | |
| player.controls = true; | |
| notify("Preview is ready. Press play to watch."); | |
| } | |
| } | |
| $("player").addEventListener("ended", () => { | |
| state.previewPlaying = false; | |
| if (!state.finalUrl) { | |
| if (state.previewQueue.length) playNextPreview(); | |
| else if (state.busy) $("loading-text").textContent = "Rendering the next preview segment…"; | |
| } | |
| }); | |
| function queuePreview(media) { | |
| const url = mediaUrl(media); | |
| if (!url || state.finalUrl) return; | |
| state.previewQueue.push(url); | |
| playNextPreview(); | |
| } | |
| function showFinal(payload, record = true) { | |
| const url = mediaUrl(payload.video); | |
| if (!url) throw new Error("The final video did not include a playable URL."); | |
| state.finalUrl = url; | |
| state.previewQueue = []; | |
| state.previewPlaying = false; | |
| const player = $("player"); | |
| player.pause(); | |
| showPlayer(); | |
| player.controls = true; | |
| player.loop = true; | |
| player.muted = false; | |
| player.src = url; | |
| player.play().catch(() => {}); | |
| $("loading-overlay").hidden = true; | |
| $("download-link").href = url; | |
| $("download-link").hidden = false; | |
| $("result-meta").textContent = `${payload.info || "Render complete"} · Seed ${payload.seed}`; | |
| setStageStatus("Complete"); | |
| if (record) addHistory(payload, url); | |
| } | |
| function addHistory(payload, url) { | |
| state.history.unshift({ | |
| url, | |
| prompt: payload.prompt || $("prompt").value.trim(), | |
| seed: payload.seed, | |
| length: payload.length || state.length, | |
| info: payload.info || "FastFrames-L render", | |
| }); | |
| state.history = state.history.slice(0, 8); | |
| renderHistory(); | |
| } | |
| function renderHistory() { | |
| const list = $("history-list"); | |
| list.innerHTML = ""; | |
| $("history-count").textContent = state.history.length ? `${state.history.length} saved` : ""; | |
| if (!state.history.length) { | |
| list.innerHTML = '<div class="history-empty">Your finished scenes will be kept here for this session.</div>'; | |
| return; | |
| } | |
| state.history.forEach((item, index) => { | |
| const button = document.createElement("button"); | |
| button.className = "history-item"; | |
| button.title = item.prompt; | |
| const video = document.createElement("video"); | |
| video.muted = true; | |
| video.playsInline = true; | |
| video.preload = "metadata"; | |
| video.src = `${item.url}#t=0.1`; | |
| const caption = document.createElement("div"); | |
| caption.className = "history-caption"; | |
| const title = document.createElement("strong"); | |
| title.textContent = `Scene ${state.history.length - index} · ${item.length}`; | |
| const detail = document.createElement("span"); | |
| detail.textContent = `Seed ${item.seed} · ${item.prompt}`; | |
| caption.append(title, detail); | |
| button.append(video, caption); | |
| button.onclick = () => { | |
| $("prompt").value = item.prompt; | |
| $("seed").value = item.seed; | |
| $("randomize").checked = false; | |
| selectLength(item.length); | |
| showFinal({ ...item, video: { url: item.url } }, false); | |
| notify("Scene restored from this session."); | |
| }; | |
| list.appendChild(button); | |
| }); | |
| } | |
| function selectLength(length) { | |
| if (!["2 s", "3 s", "4 s", "5 s"].includes(length)) return; | |
| state.length = length; | |
| document.querySelectorAll(".segment").forEach((button) => { | |
| button.classList.toggle("active", button.dataset.length === length); | |
| }); | |
| } | |
| function setView(view) { | |
| const workflow = view === "workflow"; | |
| $("create-tab").classList.toggle("active", !workflow); | |
| $("workflow-tab").classList.toggle("active", workflow); | |
| $("create-view").hidden = workflow; | |
| $("workflow-view").hidden = !workflow; | |
| document.querySelector(".license-note").hidden = workflow; | |
| if (workflow && !$("workflow-frame").src) $("workflow-frame").src = "/workflow/?ui=canvas"; | |
| } | |
| async function getApp() { | |
| if (!state.app) state.app = await client(location.origin, { events: ["data", "status"] }); | |
| return state.app; | |
| } | |
| async function generate() { | |
| const prompt = $("prompt").value.trim(); | |
| if (!prompt) { | |
| notify("Write a prompt before generating.", true); | |
| $("prompt").focus(); | |
| return; | |
| } | |
| state.cancelled = false; | |
| resetPreview(); | |
| setBusy(true); | |
| showPlayer(); | |
| $("player").hidden = true; | |
| $("empty-state").hidden = true; | |
| $("loading-overlay").hidden = false; | |
| setProgress(0, 0); | |
| notify("Joining the ZeroGPU queue…", false, true); | |
| try { | |
| const app = await getApp(); | |
| const seed = Number.parseInt($("seed").value, 10) || 0; | |
| const submission = app.submit("/generate", { | |
| prompt, | |
| length: state.length, | |
| seed, | |
| randomize: $("randomize").checked, | |
| }); | |
| state.submission = submission; | |
| let receivedFinal = false; | |
| for await (const message of submission) { | |
| if (message.type === "status") { | |
| if (message.stage === "pending") { | |
| const position = Number.isFinite(message.position) ? ` · queue ${message.position + 1}` : ""; | |
| notify(`Waiting for a GPU${position}`, false, true); | |
| } else if (message.stage === "generating") { | |
| notify("Generating your scene…", false, true); | |
| } else if (message.stage === "error") { | |
| throw new Error(message.message || "Generation failed."); | |
| } | |
| continue; | |
| } | |
| if (message.type !== "data") continue; | |
| const payload = unwrapData(message); | |
| if (!payload || typeof payload !== "object" || !payload.kind) continue; | |
| if (payload.kind === "started") { | |
| $("seed").value = payload.seed; | |
| setProgress(0, payload.total_frames); | |
| } else if (payload.kind === "chunk") { | |
| setProgress(payload.frames, payload.total_frames); | |
| queuePreview(payload.video); | |
| notify(`Rendered ${payload.frames} of ${payload.total_frames} frames`, false, true); | |
| } else if (payload.kind === "final") { | |
| receivedFinal = true; | |
| showFinal(payload); | |
| notify("Your scene is ready."); | |
| } | |
| } | |
| if (!receivedFinal && !state.cancelled) throw new Error("Generation ended without a final video."); | |
| } catch (error) { | |
| if (!state.cancelled) { | |
| notify(error?.message || String(error), true, true); | |
| setStageStatus("Error"); | |
| $("loading-overlay").hidden = true; | |
| if (!state.finalUrl) $("empty-state").hidden = false; | |
| } | |
| } finally { | |
| setBusy(false); | |
| if (state.cancelled) { | |
| $("loading-overlay").hidden = true; | |
| setStageStatus("Stopped"); | |
| notify("Generation stopped."); | |
| } | |
| } | |
| } | |
| $("run-button").onclick = () => { | |
| if (state.busy) { | |
| state.cancelled = true; | |
| state.submission?.cancel(); | |
| notify("Stopping after the current operation…", false, true); | |
| } else { | |
| generate(); | |
| } | |
| }; | |
| $("new-button").onclick = () => { | |
| if (state.busy) return; | |
| resetPreview(); | |
| $("loading-overlay").hidden = true; | |
| $("prompt").value = ""; | |
| $("prompt").focus(); | |
| setStageStatus("Ready"); | |
| notify("A fresh canvas is ready."); | |
| }; | |
| $("clear-history").onclick = () => { | |
| state.history = []; | |
| renderHistory(); | |
| notify("Session history cleared."); | |
| }; | |
| $("theme-toggle").onclick = () => { | |
| const dark = document.documentElement.dataset.theme !== "dark"; | |
| document.documentElement.dataset.theme = dark ? "dark" : "light"; | |
| document.querySelector('meta[name="theme-color"]').content = dark ? "#000000" : "#f5f5f7"; | |
| }; | |
| if (window.matchMedia?.("(prefers-color-scheme: dark)").matches) { | |
| document.documentElement.dataset.theme = "dark"; | |
| document.querySelector('meta[name="theme-color"]').content = "#000000"; | |
| } | |
| $("prompt").addEventListener("input", () => $("char-count").textContent = `${$("prompt").value.length} / 2000`); | |
| $("prompt").dispatchEvent(new Event("input")); | |
| document.addEventListener("keydown", (event) => { | |
| if ((event.metaKey || event.ctrlKey) && event.key === "Enter" && !state.busy && $("create-view").hidden === false) generate(); | |
| }); | |
| document.querySelectorAll(".segment").forEach((button) => button.onclick = () => selectLength(button.dataset.length)); | |
| $("create-tab").onclick = () => setView("create"); | |
| $("workflow-tab").onclick = () => setView("workflow"); | |
| EXAMPLES.forEach((example) => { | |
| const button = document.createElement("button"); | |
| button.className = "example-chip"; | |
| button.textContent = example.label; | |
| button.title = example.prompt; | |
| button.onclick = () => { | |
| $("prompt").value = example.prompt; | |
| $("prompt").dispatchEvent(new Event("input")); | |
| $("prompt").focus(); | |
| }; | |
| $("examples").appendChild(button); | |
| }); | |
| </script> | |
| </body> | |
| </html> | |