Download viewer/template.html from Shenhan/Flow4RT: direct link, hf CLI and curl.
- Browser
- Download file 11 kB
-
https://huggingface.co/spaces/Shenhan/Flow4RT/resolve/main/viewer/template.html
- Command line
-
hf download hf://spaces/Shenhan/Flow4RT/viewer/template.html
-
curl -L -o template.html https://huggingface.co/spaces/Shenhan/Flow4RT/resolve/main/viewer/template.html
11 kB
| <!-- Flow4RT 4D viewer, written by visualize.py; styles follow the project page. --> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1"> | |
| <title>{{TITLE}} · Flow4RT</title> | |
| <style> | |
| :root { | |
| --text: #1d232c; --ink: #14181f; --text-soft: #586272; --line: #e2e7ee; --line-strong: #cfd7e2; | |
| --accent: #1a73e8; --accent-ink: #0f57b8; --accent-soft: #e8f0fe; --track: #e9edf3; | |
| --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 6px 20px rgba(16, 24, 40, .06); | |
| --radius: 14px; --ctl: 36px; --ctl-sm: 30px; | |
| --ring: 0 0 0 3px rgba(26, 115, 232, .28); | |
| --ease: .16s cubic-bezier(.2, .7, .3, 1); | |
| } | |
| * { box-sizing: border-box; } | |
| body { margin: 0; background: #fff; color: var(--text); -webkit-font-smoothing: antialiased; | |
| font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; } | |
| button { font: inherit; } | |
| :is(button, input):focus { outline: none; } | |
| button:focus-visible { box-shadow: var(--ring); } | |
| img { max-width: 100%; display: block; } | |
| .btn { display: inline-flex; align-items: center; height: var(--ctl-sm); padding: 0 13px; border-radius: 999px; cursor: pointer; | |
| background: #fff; color: var(--ink); border: 1px solid var(--line-strong); font-size: .85rem; font-weight: 500; white-space: nowrap; | |
| transition: background var(--ease), border-color var(--ease), color var(--ease); } | |
| .btn:hover { background: var(--accent-soft); color: var(--accent-ink); border-color: #bcd3f8; } | |
| .icon-btn { flex: none; width: var(--ctl); height: var(--ctl); border-radius: 50%; padding: 0; cursor: pointer; | |
| display: inline-flex; align-items: center; justify-content: center; background: var(--accent); color: #fff; border: 1px solid var(--accent); | |
| transition: background var(--ease), transform var(--ease); } | |
| .icon-btn:hover { background: var(--accent-ink); } | |
| .icon-btn:active { transform: scale(.94); } | |
| .icon-btn svg { width: 16px; height: 16px; } | |
| /* Sliders: a thin track filled up to the thumb (--p, kept by the script at the end). */ | |
| input[type=range] { -webkit-appearance: none; appearance: none; height: 20px; margin: 0; background: transparent; cursor: pointer; --p: 0%; } | |
| input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 999px; | |
| background: linear-gradient(to right, var(--accent) var(--p), var(--track) var(--p)); } | |
| input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; margin-top: -5px; border-radius: 50%; | |
| background: #fff; border: 2px solid var(--accent); box-shadow: 0 1px 3px rgba(16, 24, 40, .2); } | |
| input[type=range]::-moz-range-track { height: 4px; border-radius: 999px; background: var(--track); } | |
| input[type=range]::-moz-range-progress { height: 4px; border-radius: 999px; background: var(--accent); } | |
| input[type=range]::-moz-range-thumb { width: 10px; height: 10px; border-radius: 50%; background: #fff; border: 2px solid var(--accent); } | |
| .seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px; background: var(--track); } | |
| .seg button { border: 0; background: transparent; color: var(--text-soft); font-weight: 500; font-size: .85rem; line-height: 1; | |
| height: calc(var(--ctl-sm) - 6px); padding: 0 13px; border-radius: 999px; cursor: pointer; white-space: nowrap; | |
| transition: background var(--ease), color var(--ease); } | |
| .seg button:hover { color: var(--ink); } | |
| .seg button.on { background: var(--accent); color: #fff; font-weight: 600; | |
| box-shadow: 0 1px 2px rgba(15, 87, 184, .35), 0 2px 8px rgba(26, 115, 232, .28); } | |
| .ctl { display: flex; align-items: center; gap: 8px; font-size: .85rem; } | |
| .ctl > .lab { color: var(--text-soft); font-weight: 500; white-space: nowrap; } | |
| .ctl input[type=range] { width: 110px; } | |
| .ctl .val { min-width: 34px; color: var(--text-soft); font-variant-numeric: tabular-nums; } | |
| /* On / off options as chips, on the same soft track as the switches beside them (.seg); tinted blue when on. */ | |
| .check { display: inline-flex; gap: 7px; align-items: center; height: var(--ctl-sm); padding: 0 13px 0 9px; border-radius: 999px; | |
| border: 1px solid transparent; background: var(--track); color: var(--text-soft); font-size: .85rem; font-weight: 500; | |
| cursor: pointer; user-select: none; transition: background var(--ease), border-color var(--ease), color var(--ease); } | |
| .check:hover { color: var(--ink); } | |
| .check input { -webkit-appearance: none; appearance: none; flex: none; width: 14px; height: 14px; margin: 0; border-radius: 50%; | |
| border: 1.5px solid #b3bdcb; background: #fff center / 10px no-repeat; cursor: inherit; } | |
| .check input:checked { border-color: var(--accent); background-color: var(--accent); | |
| background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.2l2.4 2.4 4.6-5' fill='none' stroke='white' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); } | |
| .check:has(input:checked) { background: var(--accent-soft); color: var(--accent-ink); } | |
| /* Reset view and Download: plain actions among them, in their colours. */ | |
| .controls .btn { background: var(--track); border-color: transparent; color: var(--text-soft); font-weight: 500; text-decoration: none; } | |
| .controls .btn:hover { background: var(--accent-soft); border-color: transparent; color: var(--accent-ink); } | |
| .controls .btn[hidden] { display: none; } | |
| /* Download: a round arrow button, before Reset view. */ | |
| .controls .download { width: var(--ctl-sm); padding: 0; justify-content: center; flex: none; color: var(--accent); } | |
| .controls .download svg { width: 16px; height: 16px; } | |
| .check.off { opacity: .4; cursor: not-allowed; } | |
| .viewer { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 18px; padding: 16px; height: 100vh; } | |
| .main { display: flex; flex-direction: column; min-height: 0; } | |
| .canvas-box { position: relative; flex: 1; min-height: 240px; border-radius: var(--radius); overflow: hidden; | |
| background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow); } | |
| .canvas-box canvas { width: 100%; height: 100%; display: block; cursor: grab; } | |
| .canvas-box canvas:active { cursor: grabbing; } | |
| .overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; | |
| background: rgba(255, 255, 255, .78); color: #333; font-weight: 600; font-size: .95rem; text-align: center; padding: 0 20px; } | |
| .overlay .spin { width: 22px; height: 22px; border: 3px solid #d3dae3; border-top-color: var(--accent); border-radius: 50%; | |
| animation: spin .8s linear infinite; margin-right: 10px; flex: none; } | |
| @keyframes spin { to { transform: rotate(360deg); } } | |
| .hint { position: absolute; bottom: 8px; right: 12px; font-size: .75rem; color: #7b8594; pointer-events: none; } | |
| .timeline { display: flex; align-items: center; gap: 12px; margin-top: 12px; } | |
| .timeline input[type=range] { flex: 1; } | |
| .tlabel { min-width: 70px; text-align: right; font-size: .8rem; color: var(--text-soft); font-variant-numeric: tabular-nums; } | |
| .controls { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; } | |
| /* Two rows: the view's settings, then Reset view and the on / off options; each wraps in narrow windows. */ | |
| .controls .row { display: flex; flex-wrap: wrap; gap: 12px 22px; align-items: center; } | |
| .side { display: flex; flex-direction: column; gap: 12px; overflow-y: auto; } | |
| .side figure { margin: 0; } | |
| .side figcaption { font-size: .78rem; color: var(--text-soft); margin-bottom: 3px; } | |
| .imgbox { position: relative; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); background: #000; } | |
| .imgbox img { width: 100%; } | |
| .imgbox canvas { position: absolute; inset: 0; width: 100%; height: 100%; } | |
| .scene-title { font-weight: 700; font-size: 1.05rem; color: var(--ink); } | |
| .scene-sub { color: var(--text-soft); font-size: .85rem; } | |
| /* Without data (the web demo before its first run): a blank canvas with a note, inert controls, empty frames. */ | |
| .no-data .overlay { background: transparent; color: var(--text-soft); font-weight: 500; } | |
| .no-data .timeline, .no-data .controls { opacity: .5; pointer-events: none; } | |
| .no-data .imgbox { aspect-ratio: 16 / 9; background: var(--track); border-color: transparent; } | |
| .no-data .imgbox img, .no-data .hint, .no-data .side > div:first-child { display: none; } | |
| @media (max-width: 900px) { | |
| .viewer { grid-template-columns: minmax(0, 1fr); height: auto; } | |
| .canvas-box { flex: none; aspect-ratio: 4 / 3; } | |
| .side { display: grid; grid-template-columns: 1fr 1fr; } | |
| .side > div:first-child { grid-column: 1 / -1; } /* the title above the two frames, side by side */ | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <div class="viewer"> | |
| <div class="main"> | |
| <div class="canvas-box"> | |
| <canvas class="gl"></canvas> | |
| <div class="overlay"><div class="spin"></div>Loading…</div> | |
| <span class="hint">drag: orbit · scroll: zoom · right-drag: pan</span> | |
| </div> | |
| <div class="timeline"> | |
| <button class="icon-btn playbtn" aria-label="Pause"></button> | |
| <input type="range" min="0" max="1" value="0" aria-label="Frame"> | |
| <span class="tlabel"></span> | |
| </div> | |
| <div class="controls"> | |
| <div class="row"> | |
| <div class="seg seg-mode"><button data-v="track">Tracking</button><button data-v="recon">Reconstruction</button></div> | |
| <label class="ctl"><span class="lab">Confidence ≥</span><input type="range" id="opt-conf" min="0" max="90" step="5" value="20"><span class="val"></span></label> | |
| <label class="ctl"><span class="lab">Point size</span><input type="range" id="opt-size" min="0.3" max="2.5" step="0.05" value="1"></label> | |
| </div> | |
| <div class="row"> | |
| <a class="btn download" hidden aria-label="Download" title="Download this viewer (a self-contained HTML file)"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 4v11M7 10.5l5 5 5-5M5 20h14"/></svg></a> | |
| <button class="btn reset">Reset view</button> | |
| <label class="check"><input type="checkbox" id="opt-trails" checked> Tracks</label> | |
| <label class="check"><input type="checkbox" id="opt-moving" checked> Dynamic only</label> | |
| <label class="check"><input type="checkbox" id="opt-current" checked> Current frame</label> | |
| <label class="check"><input type="checkbox" id="opt-accum"> Accumulate frames</label> | |
| <label class="check"><input type="checkbox" id="opt-cams" checked> Cameras</label> | |
| </div> | |
| </div> | |
| </div> | |
| <aside class="side"> | |
| <div><div class="scene-title">{{TITLE}}</div><div class="scene-sub"></div></div> | |
| <figure class="frame0"><figcaption>Anchor frame · track queries</figcaption><div class="imgbox"><img alt="Anchor frame"><canvas></canvas></div></figure> | |
| <figure class="framet"><figcaption>Frame 1</figcaption><div class="imgbox"><img alt="Current frame"></div></figure> | |
| </aside> | |
| </div> | |
| <script>window.F4RT = { parts: [], add(p) { this.parts.push(p); } };</script> | |
| {{SCRIPTS}} | |
| </body> | |
| </html> | |