Enterprise: 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.
caution
Make sure you add your s3 details for image_editing
server, so you can receive image generated in your bucket.
Images generated without s3 details being added will be delete after 24hours
Request
--request POST 'https://modelslab.com/api/v1/enterprise/image_editing/multiview' \
Make a POST
request to https://modelslab.com/api/v1/enterprise/image_editing/multiview 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 |
image | initial image url |
width | Width of generated images. Default: 640px. Max: 1024px |
height | Height of generated images. Default: 960px. Max: 1024px |
temp | true if you want proxy links to access images apart from normal links. Useful in case your country blocks our storage provider. Default: false |
num_inference_steps | Number of denoising steps (minimum: 1; maximum: 50) |
guidance_scale | Scale for classifier-free guidance (minimum: 1; maximum: 20) |
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":"",
"seed":null,
"image":"https://pub-3626123a908346a7a8be8d9295f44e26.r2.dev/livewire-tmp/PTnppRlMnh5qKdwtzoOFs1CCkufWU9-metaZG93bmxvYWQuanBn-.jpg",
"prompt": "make multiple images",
"width": 640,
"height":960,
"num_inference_steps":31,
"guidance_scale":7.5,
"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":31,
"guidance_scale":7.5,
"temp": 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/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" => 31,
"guidance_scale" => 7.5,
"temp": false,
"webhook" => null,
"track_id" => null
];
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://modelslab.com/api/v1/enterprise/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/v1/enterprise/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":31,
"guidance_scale":7.5,
"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/v1/enterprise/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":41,
"guidance_scale":7.5,
"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\":31,\n \"guidance_scale\":7.5,\n \"temp\":\"false\",\n \"webhook\": null,\n \"track_id\": null \n}");
Request request = new Request.Builder()
.url("https://modelslab.com/api/v1/enterprise/image_editing/multiview")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
Response
Example Response
{
"status": "success",
"generationTime": 10.116175889968872,
"id": 657,
"output": [
"https://pub-3626123a908346a7a8be8d9295f44e26.r2.dev/temp/3874004d-cec3-42fa-8662-4f24345d4b15.png"
],
"proxy_links": [
"https://cdn2.stablediffusionapi.com/temp/3874004d-cec3-42fa-8662-4f24345d4b15.png"
],
"meta": {
"file_prefix": "2ee9e794-7b5a-4e2d-80b1-7e6a943a8a36",
"guidance_scale": 7.5,
"height": 960,
"image": "https://cdn2.stablediffusionapi.com/generations/2874812851699698333.png",
"num_inference_steps": 31,
"outdir": "out",
"prompt": "make multiple images",
"seed": null,
"temp": "no",
"width": 640
}
}