11"use client" ;
22
33import { Button } from "@cloudflare/kumo/components/button" ;
4+ import { Meter } from "@cloudflare/kumo/components/meter" ;
45import { cva } from "class-variance-authority" ;
56import Image from "next/image" ;
67import { useState } from "react" ;
@@ -23,15 +24,6 @@ const previewContainerStyles = cva([
2324 "bg-[repeating-conic-gradient(#80808020_0%_25%,transparent_0%_50%)]" ,
2425 "bg-size-[20px_20px]" ,
2526] ) ;
26- const progressBarContainerStyles = cva ( [
27- "w-full bg-(--surface-tint) rounded-full h-2 mb-2" ,
28- ] ) ;
29- const progressBarStyles = cva ( [
30- "bg-(--accent) h-2 rounded-full transition-[width] duration-300" ,
31- ] ) ;
32- const progressTextStyles = cva ( [
33- "text-[0.85rem] text-(--foreground-muted) text-center" ,
34- ] ) ;
3527
3628export default function BackgroundRemoverApp ( ) {
3729 const [ imageData , setImageData ] = useState < ImageData | null > ( null ) ;
@@ -71,6 +63,8 @@ export default function BackgroundRemoverApp() {
7163 const { removeBackground } = await import ( "@imgly/background-removal" ) ;
7264
7365 const blob = await removeBackground ( imageData . src , {
66+ model : "isnet" ,
67+ device : "gpu" ,
7468 progress : ( key , current , total ) => {
7569 setProgress ( { key, current, total } ) ;
7670 } ,
@@ -150,15 +144,14 @@ export default function BackgroundRemoverApp() {
150144
151145 { isProcessing && progress && (
152146 < div className = "mb-4" >
153- < div className = { progressBarContainerStyles ( ) } >
154- < div
155- className = { progressBarStyles ( ) }
156- style = { { width : `${ progressPercent } %` } }
157- />
158- </ div >
159- < p className = { progressTextStyles ( ) } >
160- { progress . key } — { progressPercent } %
161- </ p >
147+ < Meter
148+ label = {
149+ progress . key . includes ( "fetch" )
150+ ? "Fetching model…"
151+ : "Removing background…"
152+ }
153+ value = { progressPercent }
154+ />
162155 </ div >
163156 ) }
164157
0 commit comments