If you're looking for an API, here is a sample code in NodeJS to help you out.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
const axios = require('axios');
const api_key = "YOUR API KEY";
const url = "https://api.segmind.com/workflows/66721b60458d41fc488fa95d-v1";
const data = {
face_image: "publicly accessible image link",
hair_color: "the user input string"
};
axios.post(url, data, {
headers: {
'x-api-key': api_key,
'Content-Type': 'application/json'
}
}).then((response) => {
console.log(response.data);
});
1
2
3
4
5
{
"poll_url": "<base_url>/requests/<some_request_id>",
"request_id": "some_request_id",
"status": "QUEUED"
}
You can poll the above link to get the status and output of your request.
1
2
3
{
"output_image": "image in URL Format"
}
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.
Unlock the full potential of generative AI with Segmind. Create stunning visuals and innovative designs with total creative control. Take advantage of powerful development tools to automate processes and models, elevating your creative workflow.
Run generative AI models with minimal latencies and setup costs, optimizing resource use and speed.
Run generative AI models with minimal latencies and setup costs, optimizing resource use and speed.
Run generative AI models with minimal latencies and setup costs, optimizing resource use and speed.
Run generative AI models with minimal latencies and setup costs, optimizing resource use and speed.
Hair Style and Color Change workflow enables the transformation of hair aesthetics by altering hair styles and colors using advanced inpainting techniques. This workflow is designed to seamlessly integrate into image editing processes, allowing users to experiment with different hair looks by just providing text prompts.
The Hair Style and Color Change workflow involves a structured approach with distinct computational steps:
Automatic Mask Generation: The process initiates with the creation of a hair mask utilizing an automatic mask generator. This step isolates the hair from the rest of the image, ensuring precise modifications.
Input and Processing: The image of the person along with the generated mask is forwarded to the Fooocus model. This AI model is specialized in inpainting techniques, capable of understanding the context and accurately applying the desired changes.
Text-Prompt Driven Rendering: By processing the text prompts, the model determines the specifics of the new hair style and color, generating an output that aligns with user specifications.
Output Image: The finalized image showcases a transformation in hair style or color that accurately reflects the input text prompts, maintaining a natural and coherent look.
Image Selection: Begin with selecting the image you wish to alter.
Mask Generation: Utilize the automatic mask generator to create a precise mask of the hair region.
Text Prompt Submission: Enter a text prompt describing the desired hair style or color change, such as "wavy blonde".
Model Processing: Allow the Fooocus model to process the image and the text input, generating the altered image.
Review and Refine: Examine the output and, if necessary, adjust your text prompt for iterations to achieve desired results.
Virtual Hairstyling: Ideal for apps and platforms that offer virtual try-on experiences, helping users visualize potential hair style and color changes before real-world application.
Fashion and Beauty Industries: Useful for stylists and designers to experiment with and present new trends and looks without physical alterations.
Film and Media Production: Supports creative processes in determining character appearance changes efficiently.
Personal Use: Allows individuals to preview different hair transformations for personal styling decisions or social media content creation.