Perfect Corp’s Hair Style
Model Information
Input
Configure model parameters
Output
View generated results
Result
Preview, share or download your results with a single click.

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 requestsimport timeAPI_KEY = "YOUR_API_KEY" # Replace with your API keyHEADERS = {"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": "each-hairstyle","version": "0.0.1","input": {"style": "your style here","file_url": "your image url here","gender": "your gender here"}})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 resultelif 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 predictionprediction_id = create_prediction()print(f"Prediction created: {prediction_id}")# Get resultresult = 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: ~13 seconds
- Rate limit: 60 requests/minute
- Concurrent requests: 10 maximum
- Use long-polling to check prediction status until completion
Overview
The AI Hairstyle Generator is a powerful web-based tool that uses cutting-edge artificial intelligence to transform the way users explore hairstyles. By analyzing uploaded photos, it overlays realistic virtual hairstyles, allowing users to try various cuts, styles, and colors without physical alterations. This tool caters to individuals seeking personal makeovers, hairstylists consulting clients, and businesses offering virtual beauty experiences.
Technical Specifications
AI-Powered Engine: Employs advanced facial recognition and AI to map hairstyles onto the uploaded image accurately.
Customizable Options: Includes adjustable features for color intensity, hair texture, and length.
Key Considerations
Realism vs. Actual Results: While the AI provides a close approximation, individual hair texture, density, and volume might affect how styles look in real life.
Privacy Concerns: Uploaded images are processed by AI; ensure compliance with privacy policies before using.
Lighting and Contrast: Dimly lit or overexposed photos might reduce the tool's accuracy.
Tips & Tricks
Match Styles to Face Shape: Use the tool to identify styles that suit your face shape (round, oval, square, etc.).
Combine Colors and Styles: Test combinations of cuts and colors for a comprehensive transformation.
Save and Share Results: Export your favorite looks to consult with a hairstylist or share on social media.
Use for Event Planning: Experiment with styles tailored to upcoming events, such as weddings or formal gatherings.
Capabilities
Diverse Style Options: Offers short, medium, and long hairstyles across various categories (e.g., casual, formal, edgy).
Advanced Hair Color Try-On: Includes natural shades (blonde, brunette, red) and bold, experimental hues (purple, pink, green).
Gender-Neutral Styles: Provides styles suitable for all genders and preferences.
Enhanced Filters: Adjust brightness, contrast, and other photo elements to improve visualization.
What can I use for?
Personal Grooming: Test hairstyles before committing to a haircut or dye.
Professional Consultations: Stylists can use this tool to showcase possibilities to clients.
Social Media Content: Generate and share trendy hairstyle looks.
E-Commerce: Businesses can offer virtual hair try-on services for customers exploring styling products.
Things to be aware of
Seasonal Hair Trends: Test the latest hairstyle trends, such as summer highlights or winter tones.
Event-Specific Looks: Experiment with glamorous styles for weddings, parties, or professional headshots.
Edgy Transformations: Go bold with virtual buzz cuts, undercuts, or pastel hues.
Cross-Gender Styles: Step out of your comfort zone and try styles traditionally associated with another gender.
Limitations
Accessory Obstruction: Glasses, hats, or jewelry may distort hairstyle placement. Remove them for accurate results.
Hair Overlays for Complex Styles: Extremely intricate styles (e.g., braided updos) may not be perfectly replicated.
Skin Tone Adjustments: While colors are applied, they may not always match skin undertones as a professional coloring would.
Limited Ethnic Hair Representation: Ensure the generator supports a diverse range of hair textures for accurate results.
The model works best with natural hair colors and styles.
Output Format: JPG