Photomaker

photomaker-style

Create photos, paintings and avatars for anyone in any style within seconds. (Stylization version)

L40S 45GB
Fast Inference
REST API

Model Information

Response Time~21 sec
StatusActive
Version
0.0.1
Updated23 days ago

Prerequisites

  • Create an API Key from the Eachlabs Console
  • Install the required dependencies for your chosen language (e.g., requests for Python)

API Integration Steps

1. Create a Prediction

Send a POST request to create a new prediction. This will return a prediction ID that you'll use to check the result. The request should include your model inputs and API key.

import requests
import time
API_KEY = "YOUR_API_KEY" # Replace with your API key
HEADERS = {
"X-API-Key": API_KEY,
"Content-Type": "application/json"
}
def create_prediction():
response = requests.post(
"https://api.eachlabs.ai/v1/prediction/",
headers=HEADERS,
json={
"model": "photomaker-style",
"version": "0.0.1",
"input": {
"seed": null,
"prompt": "A photo of a person img",
"num_steps": "20",
"style_name": "(No style)",
"input_image": "your_file.image/jpeg",
"num_outputs": "1",
"input_image2": "your_file.image/jpeg",
"input_image3": "your_file.image/jpeg",
"input_image4": "your_file.image/jpeg",
"guidance_scale": "5",
"negative_prompt": "nsfw, lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry",
"style_strength_ratio": "20",
"disable_safety_checker": false
}
}
)
prediction = response.json()
if prediction["status"] != "success":
raise Exception(f"Prediction failed: {prediction}")
return prediction["predictionID"]

2. Get Prediction Result

Poll the prediction endpoint with the prediction ID until the result is ready. The API uses long-polling, so you'll need to repeatedly check until you receive a success status.

def get_prediction(prediction_id):
while True:
result = requests.get(
f"https://api.eachlabs.ai/v1/prediction/{prediction_id}",
headers=HEADERS
).json()
if result["status"] == "success":
return result
elif result["status"] == "error":
raise Exception(f"Prediction failed: {result}")
time.sleep(1) # Wait before polling again

3. Complete Example

Here's a complete example that puts it all together, including error handling and result processing. This shows how to create a prediction and wait for the result in a production environment.

try:
# Create prediction
prediction_id = create_prediction()
print(f"Prediction created: {prediction_id}")
# Get result
result = get_prediction(prediction_id)
print(f"Output URL: {result['output']}")
print(f"Processing time: {result['metrics']['predict_time']}s")
except Exception as e:
print(f"Error: {e}")

Additional Information

  • The API uses a two-step process: create prediction and poll for results
  • Response time: ~21 seconds
  • Rate limit: 60 requests/minute
  • Concurrent requests: 10 maximum
  • Use long-polling to check prediction status until completion

Overview

Photomaker is an advanced image generation model designed to create realistic and stylized portraits while preserving subject identity. By leveraging reference images and text prompts, the Photomaker generates high-quality personalized images across various artistic styles.

Technical Specifications

Photomaker utilizes a stacked ID embedding technique to capture and retain the subject's identity across generated images. It processes multiple reference images and generates new portraits by combining facial features with user-defined styles and prompts. The Photomaker offers control over fine-tuning generation parameters, enabling users to adjust style intensity, guidance, and fidelity.

Key Considerations

  • Identity Preservation: The Photomaker maintains facial consistency best when multiple high-quality reference images are provided.
  • Prompt Impact: Specific and structured prompts yield better results than vague descriptions.
  • Style Application: Some artistic styles may alter facial features slightly. Lowering style_strength_ratio helps retain identity.
  • Safety Features: The disable_safety_checker option removes content restrictions but should be used responsibly.

Tips & Tricks

  • Reference Images: Provide at least two images (up to four) covering different angles and lighting conditions.
  • Prompt Writing:
    • Use precise descriptions like "A cinematic close-up portrait of a man in warm golden light."
    • Avoid ambiguous terms that might introduce unwanted elements.
  • Style Selection:
    • Use "Photographic (Default)" for the most natural appearance.
    • "Cinematic" enhances lighting and depth.
    • "Comic Book" and "Fantasy Art" create stylized outputs but may slightly alter features.
  • Style Strength Ratio (style_strength_ratio):
    • For minimal style impact, keep it between 15-25.
    • For stronger stylization, use values 30-50.
  • Guidance Scale (guidance_scale):
    • Set between 3-6 for balanced results.
    • Higher values (7-10) enforce closer adherence to prompts but might reduce realism.
  • Number of Steps (num_steps):
    • Default range is 1-100; use 50-80 for optimal image quality.

Capabilities

  • Identity Preservation: Generates images that closely resemble the subject while adapting to different styles.
  • Multiple Style Options: Supports a variety of styles, from realistic to artistic interpretations.
  • Prompt-Based Control: Users can customize outputs using descriptive text prompts.
  • Multi-Image Input: Accepts up to four reference images to enhance identity consistency.
  • Adjustable Parameters: Offers fine-tuning options for style intensity, guidance, and step count.
  • High-Resolution Outputs: Produces detailed, high-quality images suitable for various use cases.

What can I use for?

  • Realistic Portraits: Generate high-quality digital portraits with natural lighting and details.
  • Creative Artwork: Explore stylized versions of a subject using different artistic styles.
  • Character Design: Create unique characters for storytelling, gaming, or digital media.
  • Marketing & Visual Content: Personalize visuals for branding, social media, and promotional materials.

Things to be aware of

  • Experiment with Style Combinations: Combine different styles by adjusting style_strength_ratio.
  • Change Scene Context: Use prompts to place subjects in different environments (e.g., "A futuristic city background with neon lights.")
  • Modify Lighting and Mood: Control ambiance using descriptive prompts (e.g., "A dramatic noir-style portrait with deep shadows.")

Limitations

  • Extreme Style Transformations: High style_strength_ratio may distort facial identity.
  • Reference Image Quality: Low-resolution or overly edited images can affect model accuracy.
  • Prompt Dependency: Poorly structured prompts may generate undesired elements.

Output Format: PNG

Related AI Models

flux-canny-pro

Flux Canny Pro

flux-canny-pro

Image to Image
bytedance

Style Changer by ByteDance

bytedance

Image to Image
flux-redux-dev

Flux Redux Dev

flux-redux-dev

Image to Image
omni-zero

Omni Zero

omni-zero

Image to Image