Object Removal Endpoint
Overview
This endpoint helps to outpaint by expanding the giving image
Request
--request POST 'https://modelslab.com/api/v6/image_editing/object_removal' \
Make a POST
request to https://modelslab.com/api/v6/image_editing/object_removal endpoint and pass the required parameters as a request body to the endpoint.
Body Attributes
Parameter | Description |
---|---|
key | Your API Key used for request authorization |
init_image | Link to the actual image |
mask_image | Link to the mask area you want to remove |
webhook | Set an URL to get a POST API call once the image generation is complete. |
track_id | This ID is returned in the response to the webhook API call. This will be used to identify the webhook request. |
Example
Body
Body
{
"key": "",
"init_image": "https://i.ibb.co/kMRK2mg/image2.jpg",
"mask_image": "https://i.ibb.co/tH0Z8HY/mask2.jpg",
"track_id":null,
"webhook":null
}
Request
- JS
- PHP
- NODE
- PYTHON
- JAVA
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({
"key": "",
"init_image": "https://i.ibb.co/kMRK2mg/image2.jpg",
"mask_image": "https://i.ibb.co/tH0Z8HY/mask2.jpg",
"track_id":null,
"webhook":null
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://modelslab.com/api/v6/image_editing/object_removal", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
<?php
$payload = [
"key": "",
"init_image" => "https://i.ibb.co/kMRK2mg/image2.jpg",
"mask_image"=> "https://i.ibb.co/tH0Z8HY/mask2.jpg",
"webhook" => null,
"track_id" => null
];
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://modelslab.com/api/v6/image_editing/object_removal',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => json_encode($payload),
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://modelslab.com/api/v6/image_editing/object_removal',
'headers': {
'Content-Type': 'application/json'
},
body: JSON.stringify({
"key": "",
"init_image": "https://i.ibb.co/kMRK2mg/image2.jpg",
"mask_image": "https://i.ibb.co/tH0Z8HY/mask2.jpg",
"track_id":null,
"webhook":null
})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
import requests
import json
url = "https://modelslab.com/api/v6/image_editing/object_removal"
payload = json.dumps({
"key": "",
"init_image": "https://i.ibb.co/kMRK2mg/image2.jpg",
"mask_image": "https://i.ibb.co/tH0Z8HY/mask2.jpg",
"webhook": None,
"track_id": None
})
headers = {
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n \"key\": \"\",\r\n \"init_image\": \"https://i.ibb.co/kMRK2mg/image2.jpg\",\r\n \"mask_image\": \"https://i.ibb.co/tH0Z8HY/mask2.jpg\",\r\n \"track_id\":null,\r\n \"webhook\":null\r\n}");
Request request = new Request.Builder()
.url("https://modelslab.com/api/v6/image_editing/object_removal")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.addHeader("X-API-Key", "{{token}}")
.build();
Response response = client.newCall(request).execute();
Response
Example Response
{
"status": "success",
"generationTime": 5.358475685119629,
"id": 108,
"output": [
"https://pub-3626123a908346a7a8be8d9295f44e26.r2.dev/generations/db872428-8864-427d-b5a1-c5f3670de7df.png"
],
"proxy_links": [
"https://cdn2.stablediffusionapi.com/generations/db872428-8864-427d-b5a1-c5f3670de7df.png"
],
"meta": {
"base64": "no",
"file_prefix": "db872428-8864-427d-b5a1-c5f3670de7df",
"image_path": "https://i.ibb.co/kMRK2mg/image2.jpg",
"mask_path": "https://i.ibb.co/tH0Z8HY/mask2.jpg",
"outdir": "out",
"seed": 90227904,
"temp": "no"
}
}