Skip to main content

Enterprise: Flux Head Shot Endpoint

Overview

This endpoint allows you to generate head shot with flux capabilities

Face gen endpoint result
caution

Make sure you add your s3 details for flux_headshot 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/flux_headshot/make_gen' \

Make a POST request to https://modelslab.com/api/v1/enterprise/flux_headshot/make_gen endpoint and pass the required parameters as a request body to the endpoint.

Body Attributes

ParameterDescription
keyRequired. Your API Key used for request authorization
promptRequired. Text prompt with description of the things you want in the image to be generated.
face_imageRequired. Link or valid base64 string image. This is the face you want your generations to resemble.
widthWidth of your generated image. Max dimension: 2048 x 2048
heightHeight of your generated image. Max dimension: 2048 x 2048
num_inference_stepsNumber of denoising steps. Max step accepted are 26
guidance_scaleScale for classifier-free guidance. Min value accepted is 1.0 and max value is 10.0
seedRequired. Seed is used to reproduce results, same seed will give you same image in return again.
base64If provided init_image is in base64 format or if you want your generated images as a base64 string, must be set to true. Default: false.
webhookSet an URL to get a POST API call once the image generation is complete.
track_idThis ID is returned in the response to the webhook API call. This will be used to identify the webhook request.

Example

Body

Body
{
"key": "",
"prompt": "pretty woman",
"negative_prompt": "anime, cartoon, drawing, big nose, long nose, fat, ugly, big lips, big mouth, face proportion mismatch, unrealistic, monochrome, lowres, bad anatomy, worst quality, low quality, blurry",
"face_image":"https://media.allure.com/photos/647f876463cd1ef47aab9c88/3:2/w_2465,h_1643,c_limit/angelina%20jolie%20blonde%20hair%20chloe.jpg",
"width": "1024",
"height": "1024",
"num_inference_steps": "21",
"seed":null,
"guidance_scale": 7.5,
"webhook": null,
"track_id": null
}

Request

var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");

var raw = JSON.stringify({
"key": "",
"prompt": "pretty woman",
"negative_prompt": "anime, cartoon, drawing, big nose, long nose, fat, ugly, big lips, big mouth, face proportion mismatch, unrealistic, monochrome, lowres, bad anatomy, worst quality, low quality, blurry",
"face_image":"https://media.allure.com/photos/647f876463cd1ef47aab9c88/3:2/w_2465,h_1643,c_limit/angelina%20jolie%20blonde%20hair%20chloe.jpg",
"width": "1024",
"height": "1024",
"num_inference_steps": "21",
"seed":null,
"guidance_scale": 7.5,
"webhook": null,
"track_id": null
});

var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};

fetch("https://modelslab.com/api/v1/enterprise/flux_headshot/make_gen", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));

Response

Example Response

{
"status": "success",
"generationTime": 7.358475685119629,
"id": 32,
"output": [
"https://pub-3626123a908346a7a8be8d9295f44e26.r2.dev/temp/8c3ef6ea-1c44-4d69-91cb-fc11971a65d1-0.png"
],
"proxy_links": [
"https://cdn2.stablediffusionapi.com/temp/8c3ef6ea-1c44-4d69-91cb-fc11971a65d1-0.png"
],
"meta": {
"base64": "no",
"face_image": "https://media.allure.com/photos/647f876463cd1ef47aab9c88/3:2/w_2465,h_1643,c_limit/angelina%20jolie%20blonde%20hair%20chloe.jpg",
"file_prefix": "8c3ef6ea-1c44-4d69-91cb-fc11971a65d1",
"guidance_scale": 7.5,
"height": 512,
"negative_prompt": "anime, cartoon, drawing, big nose, long nose, fat, ugly, big lips, big mouth, face proportion mismatch, unrealistic, monochrome, lowres, bad anatomy, worst quality, low quality, blurry",
"num_inference_steps": 21,
"prompt": "pretty woman",
"samples": 1,
"seed": 4029484891,
"temp": "yes",
"width": 512
}
}