Skip to main content

Basic usage

Send an image to a model to generate segmentation masks
import Bytez from 'bytez.js';

// insert your key
const sdk = new Bytez('BYTEZ_KEY');

// choose your model
const model = sdk.model('sayeed99/segformer-b3-fashion');

// provide the model with input
const input = {
  "url": "https://ocean.si.edu/sites/default/files/styles/3_2_largest/public/2023-11/Screen_Shot_2018-04-16_at_1_42_56_PM.png.webp?itok=Icvi-ek9"
};

// send to the model
const { error, output } = await model.run(input);

// observe the output
console.log({ error, output });

from bytez import Bytez

# insert your key
sdk = Bytez("BYTEZ_KEY")

# choose your model
model = sdk.model("sayeed99/segformer-b3-fashion")

# provide the model with input
input = {
  "url": "https://ocean.si.edu/sites/default/files/styles/3_2_largest/public/2023-11/Screen_Shot_2018-04-16_at_1_42_56_PM.png.webp?itok=Icvi-ek9"
}

# send to the model
result = model.run(input)

# observe the output
print({"error": result.error, "output": result.output})

curl -X POST 'https://api.bytez.com/models/v2/sayeed99/segformer-b3-fashion' \
-H 'Authorization: BYTEZ_KEY' \
-H 'Content-Type: application/json' \
--data '{
  "url": "https://ocean.si.edu/sites/default/files/styles/3_2_largest/public/2023-11/Screen_Shot_2018-04-16_at_1_42_56_PM.png.webp?itok=Icvi-ek9"
}'
You can send the image via url or base64 data URL.
We recommend url for better performance, as base64 increases payload size.