typefile
{
"alpha": 0.4,
"api_key": "19333c9a6ec349ec90bd394c9f47ca67",
"image": "https://replicate.delivery/pbxt/LxnUdF2r93I3YREUlUQE1q99EgyLSHkRqCA0yCL74SWdNJ3J/room3.jpg"
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_LDC**********************************
This is your API token. Keep it to yourself.
import Replicate from "replicate";
import fs from "node:fs";
const replicate = new Replicate({
auth: process.env.REPLICATE_API_TOKEN,
});
Run remodela-ai/scaling-model-v2 using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const output = await replicate.run(
"remodela-ai/scaling-model-v2:4c520357410cd8fc0bfee3b8688e47f215318d0faa717fdcb9fa5ffbe90602e3",
{
input: {
alpha: 0.4,
api_key: "19333c9a6ec349ec90bd394c9f47ca67",
image: "https://replicate.delivery/pbxt/LxnUdF2r93I3YREUlUQE1q99EgyLSHkRqCA0yCL74SWdNJ3J/room3.jpg"
}
}
);
// To access the file URL:
console.log(output.url()); //=> "http://example.com"
// To write the file to disk:
fs.writeFile("my-image.png", 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_LDC**********************************
This is your API token. Keep it to yourself.
import replicate
Run remodela-ai/scaling-model-v2 using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"remodela-ai/scaling-model-v2:4c520357410cd8fc0bfee3b8688e47f215318d0faa717fdcb9fa5ffbe90602e3",
input={
"alpha": 0.4,
"api_key": "19333c9a6ec349ec90bd394c9f47ca67",
"image": "https://replicate.delivery/pbxt/LxnUdF2r93I3YREUlUQE1q99EgyLSHkRqCA0yCL74SWdNJ3J/room3.jpg"
}
)
# To access the file URL:
print(output.url())
#=> "http://example.com"
# To write the file to disk:
with open("my-image.png", "wb") as file:
file.write(output.read())
To learn more, take a look at the guide on getting started with Python.
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_LDC**********************************
This is your API token. Keep it to yourself.
Run remodela-ai/scaling-model-v2 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": "remodela-ai/scaling-model-v2:4c520357410cd8fc0bfee3b8688e47f215318d0faa717fdcb9fa5ffbe90602e3",
"input": {
"alpha": 0.4,
"api_key": "19333c9a6ec349ec90bd394c9f47ca67",
"image": "https://replicate.delivery/pbxt/LxnUdF2r93I3YREUlUQE1q99EgyLSHkRqCA0yCL74SWdNJ3J/room3.jpg"
}
}' \
https://api.replicate.com/v1/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
{
"id": "6kn0cfm27nrj40ck4fyts5yq5g",
"model": "remodela-ai/scaling-model-v2",
"version": "4c520357410cd8fc0bfee3b8688e47f215318d0faa717fdcb9fa5ffbe90602e3",
"input": {
"alpha": 0.4,
"api_key": "19333c9a6ec349ec90bd394c9f47ca67",
"image": "https://replicate.delivery/pbxt/LxnUdF2r93I3YREUlUQE1q99EgyLSHkRqCA0yCL74SWdNJ3J/room3.jpg"
},
"logs": "2024-11-13 05:27:17.092 | INFO | predict:predict:82 - The image is already in JPG format. No conversion needed.\n2024-11-13 05:27:17.094 | DEBUG | predict:predict:96 - Image resized and converted to tensor\n2024-11-13 05:27:17.094 | INFO | predict:feed:115 - Starting feed method\n2024-11-13 05:27:17.103 | DEBUG | predict:feed:118 - Model forward pass completed\n2024-11-13 05:27:17.110 | DEBUG | predict:feed:122 - Image labeling completed\n2024-11-13 05:27:17.111 | DEBUG | predict:feed:127 - Image blending completed\n2024-11-13 05:27:17.122 | INFO | predict:feed:133 - Blended image saved to output_image.jpg\n2024-11-13 05:27:17.134 | INFO | predict:feed:140 - Saturation enhanced image saved to output_saturation.jpg\n2024-11-13 05:27:17.134 | INFO | predict:feed:143 - Applying MaskProcessor.filters_colors\n2024-11-13 05:27:17.136 | INFO | predict:feed:147 - Smooth image saved to smooth_output.jpg\n2024-11-13 05:27:17.137 | INFO | predict:feed:150 - Applying SAM model\nimage 1/1 /src/smooth_output.jpg: 1024x1024 1 0, 1 1, 1 2, 1 3, 1 4, 1 5, 1 6, 1 7, 1118.9ms\nSpeed: 4.6ms preprocess, 1118.9ms inference, 0.3ms postprocess per image at shape (1, 3, 1024, 1024)\n2024-11-13 05:27:18.267 | INFO | predict:feed:152 - Inference masks of image\n2024-11-13 05:27:18.267 | INFO | predict:feed:156 - Processing 1 inference results and applying MaskProcessor\n2024-11-13 05:27:18.268 | DEBUG | predict:feed:158 - Processing result 1\n2024-11-13 05:27:18.269 | INFO | MaskProcessor:plot_separate_and_joined_masks:50 - Plotting separate and joined masks\n2024-11-13 05:27:18.273 | INFO | MaskProcessor:plot_separate_and_joined_masks:60 - Number of masks: 8\n2024-11-13 05:27:18.273 | INFO | MaskProcessor:convert_mask_to_linear_edges:30 - Converting mask to linear edges\n2024-11-13 05:27:18.274 | DEBUG | MaskProcessor:convert_mask_to_linear_edges:40 - Mask converted to linear edges\n2024-11-13 05:27:18.292 | DEBUG | MaskProcessor:plot_separate_and_joined_masks:79 - Processed mask 1\n2024-11-13 05:27:18.292 | INFO | MaskProcessor:convert_mask_to_linear_edges:30 - Converting mask to linear edges\n2024-11-13 05:27:18.293 | DEBUG | MaskProcessor:convert_mask_to_linear_edges:40 - Mask converted to linear edges\n2024-11-13 05:27:18.310 | DEBUG | MaskProcessor:plot_separate_and_joined_masks:79 - Processed mask 2\n2024-11-13 05:27:18.310 | INFO | MaskProcessor:convert_mask_to_linear_edges:30 - Converting mask to linear edges\n2024-11-13 05:27:18.311 | DEBUG | MaskProcessor:convert_mask_to_linear_edges:40 - Mask converted to linear edges\n2024-11-13 05:27:18.331 | DEBUG | MaskProcessor:plot_separate_and_joined_masks:79 - Processed mask 3\n2024-11-13 05:27:18.332 | INFO | MaskProcessor:convert_mask_to_linear_edges:30 - Converting mask to linear edges\n2024-11-13 05:27:18.333 | DEBUG | MaskProcessor:convert_mask_to_linear_edges:40 - Mask converted to linear edges\n2024-11-13 05:27:18.349 | DEBUG | MaskProcessor:plot_separate_and_joined_masks:79 - Processed mask 4\n2024-11-13 05:27:18.349 | INFO | MaskProcessor:convert_mask_to_linear_edges:30 - Converting mask to linear edges\n2024-11-13 05:27:18.350 | DEBUG | MaskProcessor:convert_mask_to_linear_edges:40 - Mask converted to linear edges\n2024-11-13 05:27:18.366 | DEBUG | MaskProcessor:plot_separate_and_joined_masks:79 - Processed mask 5\n2024-11-13 05:27:18.366 | INFO | MaskProcessor:convert_mask_to_linear_edges:30 - Converting mask to linear edges\n2024-11-13 05:27:18.368 | DEBUG | MaskProcessor:convert_mask_to_linear_edges:40 - Mask converted to linear edges\n2024-11-13 05:27:18.383 | DEBUG | MaskProcessor:plot_separate_and_joined_masks:79 - Processed mask 6\n2024-11-13 05:27:18.383 | INFO | MaskProcessor:convert_mask_to_linear_edges:30 - Converting mask to linear edges\n2024-11-13 05:27:18.385 | DEBUG | MaskProcessor:convert_mask_to_linear_edges:40 - Mask converted to linear edges\n2024-11-13 05:27:18.397 | DEBUG | MaskProcessor:plot_separate_and_joined_masks:79 - Processed mask 7\n2024-11-13 05:27:18.397 | INFO | MaskProcessor:convert_mask_to_linear_edges:30 - Converting mask to linear edges\n2024-11-13 05:27:18.398 | DEBUG | MaskProcessor:convert_mask_to_linear_edges:40 - Mask converted to linear edges\n2024-11-13 05:27:18.411 | DEBUG | MaskProcessor:plot_separate_and_joined_masks:79 - Processed mask 8\n2024-11-13 05:27:18.431 | INFO | MaskProcessor:save_mask_as_image:44 - Saving mask as image: Joined_Masks_room.png\n2024-11-13 05:27:18.624 | DEBUG | MaskProcessor:save_mask_as_image:47 - Mask saved as Joined_Masks_room.png\n2024-11-13 05:27:18.624 | INFO | MaskProcessor:plot_separate_and_joined_masks:84 - Joined masks plotted successfully\n2024-11-13 05:27:18.624 | INFO | predict:feed:164 - Feed method completed\n2024-11-13 05:27:18.645 | INFO | predict:upload_to_imgbb:19 - Starting the upload process for file: original_pil.jpg\n2024-11-13 05:27:18.645 | DEBUG | predict:upload_to_imgbb:22 - Opened file successfully, sending request to imgBB API.\n2024-11-13 05:27:19.763 | SUCCESS | predict:upload_to_imgbb:34 - Image uploaded successfully to imgBB. URL: https://i.ibb.co/K9yNfvz/original-pil.jpg\nINFO:httpx:HTTP Request: POST https://api.replicate.com/v1/predictions \"HTTP/1.1 201 Created\"\nINFO:httpx:HTTP Request: GET https://api.replicate.com/v1/models/idea-research/ram-grounded-sam/versions/80a2aede4cf8e3c9f26e96c308d45b23c350dd36f1c381de790715007f1ac0ad \"HTTP/1.1 200 OK\"\n2024-11-13 05:27:21.850 | INFO | predict:predict:108 - Image saved to output_label_image.jpg",
"output": "https://replicate.delivery/yhqm/esR3oMboHy1PBKDHtyQ3MdaGrrkxxGwKeobVsbu4YwK5qegnA/output_label_image.jpg",
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2024-11-13T05:27:16.797Z",
"started_at": "2024-11-13T05:27:16.805106Z",
"completed_at": "2024-11-13T05:27:21.858225Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/6kn0cfm27nrj40ck4fyts5yq5g/cancel",
"get": "https://api.replicate.com/v1/predictions/6kn0cfm27nrj40ck4fyts5yq5g",
"stream": "https://stream.replicate.com/v1/files/qoxq-yljbxodz27vaxqv4llci3on4hclj4q4a32uaq3qerumojmcy6c3q",
"web": "https://replicate.com/p/6kn0cfm27nrj40ck4fyts5yq5g"
},
"metrics": {
"predict_time": 5.053119214,
"total_time": 5.061225
}
}
