1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import requests
import base64
# Use this function to convert an image file from the filesystem to base64
def image_file_to_base64(image_path):
with open(image_path, 'rb') as f:
image_data = f.read()
return base64.b64encode(image_data).decode('utf-8')
# Use this function to fetch an image from a URL and convert it to base64
def image_url_to_base64(image_url):
response = requests.get(image_url)
image_data = response.content
return base64.b64encode(image_data).decode('utf-8')
api_key = "YOUR_API_KEY"
url = "https://api.segmind.com/v1/face-detailer"
# Request payload
data = {
"image": image_url_to_base64("https://segmind-sd-models.s3.amazonaws.com/display_images/face-detailer-test-ip.png"), # Or use image_file_to_base64("IMAGE_PATH")
"prompt": "clear face and natural skin",
"negative_prompt": "bad quality, painting, blur",
"samples": 1,
"num_inference_steps": 25,
"guidance_scale": 5,
"seed": 12467,
"denoise": 0.4,
"image_format": "jpeg",
"image_quality": 95,
"base64": False
}
headers = {'x-api-key': api_key}
response = requests.post(url, json=data, headers=headers)
print(response.content) # The response is the generated image
Input image
The positive prompt describing the image
Negative prompt to avoid undesired features in the image
Number of image samples to generate
min : 1,
max : 4
Number of inference steps for image generation
min : 15,
max : 75
Guidance scale for generating the image
min : 5,
max : 10
Random seed for image generation
Denoising strength to apply during generation
min : 0,
max : 1
Format of the output image
Allowed values:
Quality of the output image
min : 10,
max : 100
Base64 encoding of the output image.
To keep track of your credit usage, you can inspect the response headers of each API call. The x-remaining-credits property will indicate the number of remaining credits in your account. Ensure you monitor this value to avoid any disruptions in your API usage.
Face Detailer is an advanced AI tool designed to enhance and restore facial features in images. Face Detailer is perfect for restoring characters’ faces in images. Its comprehensive processing pipeline ensures high-quality facial detail enhancement, making it an essential tool for photographers and digital artists.
Automatically detects and improves facial details in images. Ideal for repairing low-resolution faces with high-resolution synthesis.
Utilizes a two-step method for severely damaged faces. The first pass recreates the fundamental outline, while the second pass focuses on detailed reconstruction.
Eliminates distortion caused by the background.Ensures enhancements are aligned with face contours without affecting surrounding areas.
Upscales images to significantly increase resolution. Enhances details and reduces artifacts, perfect for high-resolution stills.
Face Detailer is perfect for restoring characters’ faces in various image formats. Its comprehensive processing pipeline ensures high-quality facial detail enhancement, making it an essential tool for photographers and digital artists.