From 2f2d39dc4c1a178123b3efff7d31f6eb63e566b8 Mon Sep 17 00:00:00 2001 From: wukko Date: Tue, 14 Jan 2025 18:30:33 +0600 Subject: [PATCH] web/removebg: fix types (remove garbage) --- web/src/lib/workers/removebg.ts | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/web/src/lib/workers/removebg.ts b/web/src/lib/workers/removebg.ts index 10cbe0ca..e6a59bcc 100644 --- a/web/src/lib/workers/removebg.ts +++ b/web/src/lib/workers/removebg.ts @@ -4,20 +4,10 @@ const models = { light: { id: "briaai/RMBG-1.4", input: "input", - modelConfig: { - device: "wasm", - dtype: "fp32", - }, - processorConfig: {}, }, heavy: { id: "onnx-community/BiRefNet_lite", input: "input_image", - modelConfig: { - device: "webgpu", - dtype: "fp16", - }, - processorConfig: {}, } } @@ -25,9 +15,12 @@ export const removeImageBackground = async (file: File) => { const image = await RawImage.fromBlob(new Blob([file])); const model_type = "light"; - const model = await AutoModel.from_pretrained(models[model_type].id, models[model_type].modelConfig); + const model = await AutoModel.from_pretrained(models[model_type].id, { + device: "wasm", + dtype: "fp32", + }); - const processor = await AutoProcessor.from_pretrained(models[model_type].id, models[model_type].processorConfig); + const processor = await AutoProcessor.from_pretrained(models[model_type].id, {}); if (model && processor) { const { pixel_values } = await processor(image);