Expression Editor
Expression Editor uses reference images to accurately generate new images with desired expressions. Perfect for digital art, memes, and marketing.
1import requests
2import json
3
4url = "https://api.segmind.com/v1/expression-editor"
5headers = {
6 "x-api-key": "YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "aaa": 0,
12 "blink": 0,
13 "eee": 0,
14 "eyebrow": 0,
15 "image": "https://segmind-sd-models.s3.amazonaws.com/display_images/ep-editor-ip.png",
16 "image_format": "png",
17 "image_quality": 95,
18 "pupil_x": 0,
19 "pupil_y": 0,
20 "rotate_pitch": 0,
21 "rotate_roll": 0,
22 "rotate_yaw": 0,
23 "sample_parts": "OnlyExpression",
24 "smile": 1,
25 "wink": 0,
26 "woo": 0
27}
28
29response = requests.post(url, headers=headers, json=data)
30
31if response.status_code == 200:
32 result = response.json()
33 print(json.dumps(result, indent=2))
34else:
35 print(f"Error: {response.status_code}")
36 print(response.text) 1import requests
2import json
3
4url = "https://api.segmind.com/v1/expression-editor"
5headers = {
6 "x-api-key": "YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "aaa": 0,
12 "blink": 0,
13 "eee": 0,
14 "eyebrow": 0,
15 "image": "https://segmind-sd-models.s3.amazonaws.com/display_images/ep-editor-ip.png",
16 "image_format": "png",
17 "image_quality": 95,
18 "pupil_x": 0,
19 "pupil_y": 0,
20 "rotate_pitch": 0,
21 "rotate_roll": 0,
22 "rotate_yaw": 0,
23 "sample_parts": "OnlyExpression",
24 "smile": 1,
25 "wink": 0,
26 "woo": 0
27}
28
29response = requests.post(url, headers=headers, json=data)
30
31if response.status_code == 200:
32 result = response.json()
33 print(json.dumps(result, indent=2))
34else:
35 print(f"Error: {response.status_code}")
36 print(response.text)API Endpoint
https://api.segmind.com/v1/expression-editorParameters
imagerequiredstring (uri)URL of the Input Face Image
"https://segmind-sd-models.s3.amazonaws.com/display_images/ep-editor-ip.png"aaaoptionalnumberMouth shape for 'aaa'
0Range: -30 - 30blinkoptionalnumberBlink intensity
0Range: -20 - 5eeeoptionalnumberMouth shape for 'eee'
0Range: -15 - 15eyebrowoptionalnumberEyebrow position adjustment
0Range: -10 - 10image_formatoptionalstringOutput image format
"png""png""jpg""webp"image_qualityoptionalintegerImage quality
95Range: 10 - 100pupil_xoptionalnumberPupil X-axis position
0Range: -15 - 15pupil_yoptionalnumberPupil Y-axis position
0Range: -15 - 15ref_expression_imageoptionalstring (uri)URL of the reference expression image
nullrotate_pitchoptionalnumberPitch rotation in degrees
0Range: -20 - 20rotate_rolloptionalnumberRoll rotation in degrees
0Range: -20 - 20rotate_yawoptionalnumberYaw rotation in degrees
0Range: -20 - 20sample_partsoptionalstringPart of the face to sample
"OnlyExpression""OnlyExpression""OnlyRotation""OnlyMouth""OnlyEyes""All"smileoptionalnumberSmile intensity
0Range: -0.3 - 1.3winkoptionalnumberWink intensity
0Range: 0 - 25woooptionalnumberMouth shape for 'woo'
0Range: -15 - 15Response Type
Returns: Image
Common Error Codes
The API returns standard HTTP status codes. Detailed error messages are provided in the response body.
Bad Request
Invalid parameters or request format
Unauthorized
Missing or invalid API key
Forbidden
Insufficient permissions
Not Found
Model or endpoint not found
Insufficient Credits
Not enough credits to process request
Rate Limited
Too many requests
Server Error
Internal server error
Bad Gateway
Service temporarily unavailable
Timeout
Request timed out