typefile
{
"image": "https://replicate.delivery/pbxt/LZ407zJWvzliNmeTeeb7VVlSo8IMdFanNlGEziaIHHxXvmcS/ComfyUI_00301_.png"
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_LUq**********************************
This is your API token. Keep it to yourself.
import Replicate from "replicate";
const replicate = new Replicate({
auth: process.env.REPLICATE_API_TOKEN,
});
Run fofr/nsfw-model-comparison using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const output = await replicate.run(
"fofr/nsfw-model-comparison:684e5e879da2bcdbddc1a094650e17179d14024398d1d6146c6382ff07488fc1",
{
input: {
image: "https://replicate.delivery/pbxt/LZ407zJWvzliNmeTeeb7VVlSo8IMdFanNlGEziaIHHxXvmcS/ComfyUI_00301_.png"
}
}
);
console.log(output);
To learn more, take a look at the guide on getting started with Node.js.
pip install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_LUq**********************************
This is your API token. Keep it to yourself.
import replicate
Run fofr/nsfw-model-comparison using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"fofr/nsfw-model-comparison:684e5e879da2bcdbddc1a094650e17179d14024398d1d6146c6382ff07488fc1",
input={
"image": "https://replicate.delivery/pbxt/LZ407zJWvzliNmeTeeb7VVlSo8IMdFanNlGEziaIHHxXvmcS/ComfyUI_00301_.png"
}
)
print(output)
To learn more, take a look at the guide on getting started with Python.
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_LUq**********************************
This is your API token. Keep it to yourself.
Run fofr/nsfw-model-comparison using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
curl -s -X POST \
-H "Authorization: Bearer $REPLICATE_API_TOKEN" \
-H "Content-Type: application/json" \
-H "Prefer: wait" \
-d $'{
"version": "fofr/nsfw-model-comparison:684e5e879da2bcdbddc1a094650e17179d14024398d1d6146c6382ff07488fc1",
"input": {
"image": "https://replicate.delivery/pbxt/LZ407zJWvzliNmeTeeb7VVlSo8IMdFanNlGEziaIHHxXvmcS/ComfyUI_00301_.png"
}
}' \
https://api.replicate.com/v1/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
Object output with 4 properties
true
true
0.14787530899047852
0.4556546211242676
{
"id": "1cbcbr6c81rgm0chqmjbtj9bg0",
"model": "fofr/nsfw-model-comparison",
"version": "684e5e879da2bcdbddc1a094650e17179d14024398d1d6146c6382ff07488fc1",
"input": {
"image": "https://replicate.delivery/pbxt/LZ407zJWvzliNmeTeeb7VVlSo8IMdFanNlGEziaIHHxXvmcS/ComfyUI_00301_.png"
},
"logs": "Falcon safety check took 0.15 seconds\nCompVis safety check took 0.46 seconds\nFalcon output: True\nCompvis output: True",
"output": {
"compvis_is_safe": true,
"compvis_time_taken": 0.4556546211242676,
"falcon_is_safe": true,
"falcon_time_taken": 0.14787530899047852
},
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2024-09-04T13:06:31.104Z",
"started_at": "2024-09-04T13:10:33.79067Z",
"completed_at": "2024-09-04T13:10:34.940274Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/1cbcbr6c81rgm0chqmjbtj9bg0/cancel",
"get": "https://api.replicate.com/v1/predictions/1cbcbr6c81rgm0chqmjbtj9bg0",
"web": "https://replicate.com/p/1cbcbr6c81rgm0chqmjbtj9bg0"
},
"metrics": {
"predict_time": 1.149604509,
"total_time": 243.836274
}
}