Multiview Endpoint
Overview
This endpoint takes one input image and generates multiple views of that same image. Note that images of objects and images without a background produces better result.
Request
--request POST 'https://modelslab.com/api/v6/image_editing/multiview' \
Make a POST
request to https://modelslab.com/api/v6/image_editing/multiview endpoint and pass the required parameters as a request body to the endpoint.
Body Attributes
Parameter | Description | Values |
---|---|---|
key | Your API Key used for request authorization | string |
prompt | The text prompt describing the content you want in the generated image | string |
negative_prompt | Items you do not want in the image | string |
image | A link or valid base64 data of the image you want your generations to resemble. The format should be data:image/jpeg;base64,{your_base64_string} | URL or base64 string |
width | The width of the generated images. The default is 640 pixels. The maximum is 1024 pixels. | integer (default: 640, max: 1024) |
height | The height of the generated images. The default is 960 pixels. The maximum is 1024 pixels. | integer (default: 960, max: 1024) |
temp | Set to true if you want proxy links to access images in addition to normal links. Useful if your country blocks the storage provider. The default is false. | boolean (true/false) |
num_inference_steps | The number of denoising steps. The acceptable values are 21, 31, and 41. | integer (21, 31, or 41) |
guidance_scale | The scale for classifier-free guidance. The minimum is 1 and the maximum is 20. | integer (1 to 20) |
base64 | Set to true if the provided image is in base64 format or if you want your generated images as a base64 string. The default is false. | boolean (true/false) |
webhook | Provide a URL to receive a POST API call once the image generation is complete. | URL |
track_id | This ID is returned in the response to the webhook API call and will be used to identify the webhook request. | integral value |
Example
Body
Body
{
"key":"",
"seed":null,
"image":"https://pub-3626123a908346a7a8be8d9295f44e26.r2.dev/livewire-tmp/PTnppRlMnh5qKdwtzoOFs1CCkufWU9-metaZG93bmxvYWQuanBn-.jpg",
"prompt": "make multiple images",
"width": 640,
"height":960,
"num_inference_steps":50,
"guidance_scale":4,
"temp": 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":"",
"seed":null,
"image":"https://pub-3626123a908346a7a8be8d9295f44e26.r2.dev/livewire-tmp/PTnppRlMnh5qKdwtzoOFs1CCkufWU9-metaZG93bmxvYWQuanBn-.jpg",
"prompt": "make multiple images",
"width": 640,
"height":960,
"num_inference_steps":50,
"guidance_scale":4,
"temp": false,
"webhook": null,
"track_id": null
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://modelslab.com/api/v6/image_editing/multiview", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
<?php
$payload = [
"key" => "",
"seed" => null,
"image" => "https://pub-3626123a908346a7a8be8d9295f44e26.r2.dev/livewire-tmp/PTnppRlMnh5qKdwtzoOFs1CCkufWU9-metaZG93bmxvYWQuanBn-.jpg",
"prompt" => "make multiple images",
"width" => 640,
"height" => 960,
"num_inference_steps" => 50,
"guidance_scale" => 4,
"temp":false,
"webhook" => null,
"track_id" => null
];
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://modelslab.com/api/v6/image_editing/multiview',
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/multiview',
'headers': {
'Content-Type': 'application/json'
},
body: JSON.stringify({
"key":"",
"seed":null,
"image":"https://pub-3626123a908346a7a8be8d9295f44e26.r2.dev/livewire-tmp/PTnppRlMnh5qKdwtzoOFs1CCkufWU9-metaZG93bmxvYWQuanBn-.jpg",
"prompt": "make multiple images",
"width": 640,
"height":960,
"num_inference_steps":50,
"guidance_scale":4,
"temp":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/v6/image_editing/multiview"
payload = json.dumps({
"key":"",
"seed":null,
"image":"https://pub-3626123a908346a7a8be8d9295f44e26.r2.dev/livewire-tmp/PTnppRlMnh5qKdwtzoOFs1CCkufWU9-metaZG93bmxvYWQuanBn-.jpg",
"prompt": "make multiple images",
"width": 640,
"height":960,
"num_inference_steps":50,
"guidance_scale":4,
"temp":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, "{\n \"key\":\"\",\n \"seed\":null,\n \"image\":\"https://pub-3626123a908346a7a8be8d9295f44e26.r2.dev/livewire-tmp/PTnppRlMnh5qKdwtzoOFs1CCkufWU9-metaZG93bmxvYWQuanBn-.jpg\",\n \"prompt\": \"make multiple images\",\n \"width\": 640,\n \"height\":960,\n \"num_inference_steps\":50,\n \"guidance_scale\":4,\n \"temp\":\"false\",\n \"webhook\": null,\n \"track_id\": null \n}");
Request request = new Request.Builder()
.url("https://modelslab.com/api/v6/image_editing/multiview")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
Response
Example Response
{
"status": "success",
"generationTime": 13.116175889968872,
"id": 289386,
"output": [
"https://pub-3626123a908346a7a8be8d9295f44e26.r2.dev/temp/8b7d3a65-73e2-4d44-82b1-a333cee1ab93.png"
],
"proxy_links": [
"https://cdn2.stablediffusionapi.com/temp/efaf0575-36a6-4c1b-8236-6d44eb3fcb35.png"
],
""meta": {
"base64": "no",
"file_prefix": "986ecb6b-df2e-4478-8719-c44e43ef0dc3",
"guidance_scale": 4,
"height": 960,
"image": "https://pub-3626123a908346a7a8be8d9295f44e26.r2.dev/livewire-tmp/PTnppRlMnh5qKdwtzoOFs1CCkufWU9-metaZG93bmxvYWQuanBn-.jpg",
"num_inference_steps": 50,
"opacity": 0.7,
"outdir": "out",
"padding_down": 10,
"padding_right": 10,
"prompt": "make multiple images",
"scale_down": 6,
"seed": 1546994876,
"temp": "yes",
"watermark": "no",
"width": 640
}
}
}
}