ibelem's picture
Upload 9 files
8a7706c verified
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Transformers.js | Real-time background removal</title>
<script type="module" crossorigin src="/assets/index-DG-aHmpJ.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-Cn9SjWnX.css">
</head>
<body>
<h1>
Real-time background removal w/
<a href="https://huggingface.co/Xenova/modnet" target="_blank">MODNet</a>
</h1>
<h4>
Runs locally in your browser, powered by
<a href="https://github.com/huggingface/transformers.js" target="_blank"
>馃 Transformers.js</a
> x <label id="device"></label>
</h4>
<div id="container">
<video id="video" width="360" height="240" autoplay muted playsinline></video>
<canvas id="canvas" width="360" height="240"></canvas>
<canvas id="output-canvas" width="360" height="240"></canvas>
<button id="show-video-btn" title="Hold the button to show the original background">
<svg xmlns="http://www.w3.org/2000/svg" width="128" height="128" viewBox="0 0 24 24"><path fill="#d1d5db" d="M4 20q-.825 0-1.412-.587T2 18v-5q0-.425.288-.712T3 12t.713.288T4 13v5h12V6h-5q-.425 0-.712-.288T10 5t.288-.712T11 4h5q.825 0 1.413.588T18 6v4.5l3.15-3.15q.25-.25.55-.125t.3.475v8.6q0 .35-.3.475t-.55-.125L18 13.5V18q0 .825-.587 1.413T16 20zm2.975-6.625L5.6 15.2q-.2.25-.05.525T6 16h8q.3 0 .45-.275t-.05-.525l-2.375-3.175q-.15-.2-.4-.2t-.4.2L9 15l-1.225-1.625q-.15-.2-.4-.2t-.4.2M4 8H3q-.425 0-.712-.288T2 7t.288-.712T3 6h1V5q0-.425.288-.712T5 4t.713.288T6 5v1h1q.425 0 .713.288T8 7t-.288.713T7 8H6v1q0 .425-.288.713T5 10t-.712-.288T4 9z"/></svg>
</button>
</div>
<div id="controls">
<div
title="Read frames from your webcam and process them at a lower size (lower = faster)"
>
<label>Stream scale</label>
(<label id="scale-value">0.5</label>)
<br />
<input
id="scale"
type="range"
min="0.1"
max="1"
step="0.1"
value="0.5"
disabled
/>
</div>
<div
id="size-container"
title="The length of the shortest edge of the image (lower = faster)"
>
<label>Image size</label>
(<label id="size-value">256</label>)
<br />
<input
id="size"
type="range"
min="64"
max="512"
step="32"
value="256"
disabled
/>
</div>
</div>
<label id="status"></label>
<div>
<a href="?device=webnn-gpu">WebNN GPU</a><a href="?device=webnn-npu">WebNN NPU</a>
</div>
<div id="versions">
@huggingface/transformers: 3.7.3 路 onnxruntime-web: 1.23.0-dev.20250906-ecb26fb775
</div>
</body>
</html>