mirror of
https://github.com/imputnet/cobalt.git
synced 2025-01-15 19:35:31 +00:00
web/removebg: fix types (remove garbage)
Some checks are pending
Some checks are pending
This commit is contained in:
parent
d649a00718
commit
2f2d39dc4c
|
@ -4,20 +4,10 @@ const models = {
|
||||||
light: {
|
light: {
|
||||||
id: "briaai/RMBG-1.4",
|
id: "briaai/RMBG-1.4",
|
||||||
input: "input",
|
input: "input",
|
||||||
modelConfig: {
|
|
||||||
device: "wasm",
|
|
||||||
dtype: "fp32",
|
|
||||||
},
|
|
||||||
processorConfig: {},
|
|
||||||
},
|
},
|
||||||
heavy: {
|
heavy: {
|
||||||
id: "onnx-community/BiRefNet_lite",
|
id: "onnx-community/BiRefNet_lite",
|
||||||
input: "input_image",
|
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 image = await RawImage.fromBlob(new Blob([file]));
|
||||||
|
|
||||||
const model_type = "light";
|
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) {
|
if (model && processor) {
|
||||||
const { pixel_values } = await processor(image);
|
const { pixel_values } = await processor(image);
|
||||||
|
|
Loading…
Reference in a new issue