Enterprise: Relighting Endpoint
Overview
This endpoint helps to create lighting around image
Request
--request POST 'https://modelslab.com/api/v1/enterprise/image_editing/relighting' \
Make a POST
request to https://modelslab.com/api/v1/enterprise/image_editing/relighting 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 |
prompt | Text prompt with description of the things you want in the image to be generated |
negative_prompt | Items you don't want in the image |
init_image | Link or provide valid base64 data which follows the format data:image/jpeg;base64,{your_base64_string} to the image you want your generations to resemble. |
width | Max Height: Width: 1024x1024 |
height | Max Height: Width: 1024x1024 |
lighting | How lightening should be place. Available data are none , left , right , top , bottom |
guidance_scale | Optional. Scale for classifier-free guidance (minimum: 1; maximum: 20). Default is 7 |
highres_scale | high resolution scale. Defaults to 1.5 |
lowres_denoise | low resolution denoise. Defaults ot 0.9 |
highres_denoise | high resolution denoise defaults to 0.5 |
num_inference_steps | Number of denoising steps. Default: 20, Max: 50 |
base64 | If provided image is in base64 format or if you want your generated images as a base64 string, must be set to true . Default: false . |
seed | Seed is used to reproduce results, same seed will give you same image in return again. Pass null for a random number. |
samples | Number of images to be returned in response. The maximum value is 2. |
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://pub-3626123a908346a7a8be8d9295f44e26.r2.dev/generations/e7d2dd6f-9482-40df-a910-89cc4de2e7b6-0.png",
"lighting": "right",
"prompt": "woman, detailed, neon lighting",
"height": 512,
"width": 1024,
"samples":1,
"base64":false,
"webhook": null,
"track_id": 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://pub-3626123a908346a7a8be8d9295f44e26.r2.dev/generations/e7d2dd6f-9482-40df-a910-89cc4de2e7b6-0.png",
"lighting": "right",
"prompt": "woman, detailed, neon lighting",
"height": 512,
"width": 1024,
"samples":1,
"base64":false,
"webhook": null,
"track_id": null
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://modelslab.com/api/v1/enterprise/image_editing/relighting", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
<?php
$payload = [
"key":"",
"init_image" =>"https://pub-3626123a908346a7a8be8d9295f44e26.r2.dev/generations/e7d2dd6f-9482-40df-a910-89cc4de2e7b6-0.png",
"lighting" => "right",
"prompt" => "woman, detailed, neon lighting",
"height" => 512,
"width" => 1024,
"samples" => 1,
"base64" => false,
"webhook" => null,
"track_id" => null
];
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://modelslab.com/api/v1/enterprise/image_editing/relighting',
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/v1/enterprise/image_editing/relighting',
'headers': {
'Content-Type': 'application/json'
},
body: JSON.stringify({
"key":"",
"init_image":"https://pub-3626123a908346a7a8be8d9295f44e26.r2.dev/generations/e7d2dd6f-9482-40df-a910-89cc4de2e7b6-0.png",
"lighting": "right",
"prompt": "woman, detailed, neon lighting",
"height": 512,
"width": 1024,
"samples":1,
"base64":false,
"webhook": null,
"track_id": 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/v1/enterprise/image_editing/relighting"
payload = json.dumps({
"key":"",
"init_image":"https://pub-3626123a908346a7a8be8d9295f44e26.r2.dev/generations/e7d2dd6f-9482-40df-a910-89cc4de2e7b6-0.png",
"lighting": "right",
"prompt": "woman, detailed, neon lighting",
"height": 512,
"width": 1024,
"samples":1,
"base64":False,
"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://pub-3626123a908346a7a8be8d9295f44e26.r2.dev/generations/e7d2dd6f-9482-40df-a910-89cc4de2e7b6-0.png\",\r\n \"lighting\": \"right\",\r\n \"prompt\": \"woman, detailed, neon lighting\",\r\n \"height\": 512,\r\n \"width\": 1024,\r\n \"samples\":1,\r\n \"base64\":false\r\n\r\n}");
Request request = new Request.Builder()
.url("https://modelslab.com/api/v1/enterprise/image_editing/relighting")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
Response
Example Response
{
"status": "success",
"generationTime": 7.328356504440308,
"id": 67,
"output": [
"https://pub-3626123a908346a7a8be8d9295f44e26.r2.dev/generations/f5a759d2-9af0-4965-8894-7e4433ee76e9-0.png"
],
"proxy_links": [
"https://cdn2.stablediffusionapi.com/generations/f5a759d2-9af0-4965-8894-7e4433ee76e9-0.png"
],
"meta": {
"base64": "no",
"file_prefix": "f5a759d2-9af0-4965-8894-7e4433ee76e9",
"guidance_scale": 7,
"height": 512,
"highres_denoise": 0.5,
"highres_scale": 1.5,
"init_image": "https://pub-3626123a908346a7a8be8d9295f44e26.r2.dev/generations/e7d2dd6f-9482-40df-a910-89cc4de2e7b6-0.png",
"lighting": "right",
"lowres_denoise": 0.9,
"negative_prompt": "low quality",
"num_inference_steps": 20,
"outdir": "out",
"prompt": "woman, detailed, neon lighting",
"samples": 1,
"seed": -1,
"temp": "no",
"width": 1024
}
}