Spaces:
Running
Running
Download src/components/Progress.jsx from linoyts/Qwen-Image-2.1-WebGPU: direct link, hf CLI and curl.
- Browser
- Download file 860 Bytes
-
https://huggingface.co/spaces/linoyts/Qwen-Image-2.1-WebGPU/resolve/main/src/components/Progress.jsx
- Command line
-
hf download hf://spaces/linoyts/Qwen-Image-2.1-WebGPU/src/components/Progress.jsx
-
curl -L -o Progress.jsx https://huggingface.co/spaces/linoyts/Qwen-Image-2.1-WebGPU/resolve/main/src/components/Progress.jsx
860 Bytes
| export function formatBytes(size) { | |
| const i = size > 0 ? Math.floor(Math.log(size) / Math.log(1024)) : 0; | |
| return `${(size / 1024 ** i).toFixed(i > 1 ? 1 : 0)} ${["B", "kB", "MB", "GB", "TB"][i]}`; | |
| } | |
| export default function Progress({ text, loaded, total }) { | |
| const pct = total > 0 ? Math.min(100, (loaded / total) * 100) : 0; | |
| return ( | |
| <div className="w-full min-w-0"> | |
| <div className="flex justify-between gap-2 text-xs text-zinc-400 mb-1"> | |
| <span className="truncate min-w-0">{text}</span> | |
| <span className="shrink-0 tabular-nums">{formatBytes(loaded)} / {formatBytes(total)} ({pct.toFixed(0)}%)</span> | |
| </div> | |
| <div className="h-2 w-full rounded bg-zinc-800 overflow-hidden"> | |
| <div className="h-full bg-amber-400 transition-[width] duration-150" style={{ width: `${pct}%` }} /> | |
| </div> | |
| </div> | |
| ); | |
| } | |