Unsupported pipeline: briaai

#4
by crapthings - opened
import { pipeline, env } from '@xenova/transformers'
import { useEffect } from 'react'

console.log(env)

env.allowRemoteModels = true
env.allowLocalModels = false
env.useBrowserCache = false

export default function Page3 () {
  useEffect(() => {
    ;(async function () {
      let pipe = await pipeline('briaai', 'RMBG-1.4')
      let out = await pipe('image goes here?')

      console.log(out)
    })()
  }, [])
  return (
    <div>
      <div>page4</div>
    </div>
  )
}

export { default as layout } from '$c/blank'

Unhandled Rejection (Error): Unsupported pipeline: briaai. Must be one of [text-classification,token-classification,question-answering,fill-mask,summarization,translation,text2text-generation,text-generation,zero-shot-classification,audio-classification,zero-shot-audio-classification,automatic-speech-recognition,text-to-audio,image-to-text,image-classification,image-segmentation,zero-shot-image-classification,object-detection,zero-shot-object-detection,document-question-answering,image-to-image,depth-estimation,feature-extraction,image-feature-extraction]

Please refer to https://github.com/xenova/transformers.js/blob/main/examples/remove-background-client/main.js for example code/usage.

import { AutoModel, AutoProcessor, RawImage } from '@xenova/transformers'
// Load model and processor
const model = await AutoModel.from_pretrained('briaai/RMBG-1.4');
const processor = await AutoProcessor.from_pretrained('briaai/RMBG-1.4');

const url = '...';
const image = await RawImage.fromURL(url);

// Preprocess image
const { pixel_values } = await processor(image);

// Predict alpha matte
const { output } = await model({ input: pixel_values });

Sign up or log in to comment