-
-
Notifications
You must be signed in to change notification settings - Fork 523
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #286 from elder-plinius/master
personal_stylist
- Loading branch information
Showing
4 changed files
with
124 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
from swarms.structs import Agent | ||
import os | ||
from dotenv import load_dotenv | ||
from swarms.models import GPT4VisionAPI | ||
from swarms.prompts.personal_stylist import ( | ||
HAIRCUT_STYLIST_AGENT_PROMPT, | ||
MAKEUP_STYLIST_AGENT_PROMPT, | ||
BEARD_STYLIST_AGENT_PROMPT, | ||
CLOTHING_STYLIST_AGENT_PROMPT, | ||
ACCESSORIES_STYLIST_AGENT_PROMPT, | ||
) | ||
|
||
# Load environment variables | ||
load_dotenv() | ||
api_key = os.getenv("OPENAI_API_KEY") | ||
|
||
# Initialize GPT4VisionAPI | ||
llm = GPT4VisionAPI(openai_api_key=api_key) | ||
|
||
# User selfie and clothes images | ||
user_selfie = "user_image.jpg" | ||
clothes_image = "clothes_image2.jpg" | ||
|
||
# User gender (for conditional agent initialization) | ||
user_gender = "man" # or "woman" | ||
|
||
# Initialize agents with respective prompts for personal styling | ||
haircut_stylist_agent = Agent( | ||
llm=llm, | ||
sop=HAIRCUT_STYLIST_AGENT_PROMPT, | ||
max_loops=1, | ||
multi_modal=True, | ||
) | ||
|
||
# Conditional initialization of Makeup or Beard Stylist Agent | ||
if user_gender == "woman": | ||
makeup_or_beard_stylist_agent = Agent( | ||
llm=llm, | ||
sop=MAKEUP_STYLIST_AGENT_PROMPT, | ||
max_loops=1, | ||
multi_modal=True, | ||
) | ||
elif user_gender == "man": | ||
makeup_or_beard_stylist_agent = Agent( | ||
llm=llm, | ||
sop=BEARD_STYLIST_AGENT_PROMPT, | ||
max_loops=1, | ||
multi_modal=True, | ||
) | ||
|
||
clothing_stylist_agent = Agent( | ||
llm=llm, | ||
sop=CLOTHING_STYLIST_AGENT_PROMPT, | ||
max_loops=1, | ||
multi_modal=True, | ||
) | ||
|
||
accessories_stylist_agent = Agent( | ||
llm=llm, | ||
sop=ACCESSORIES_STYLIST_AGENT_PROMPT, | ||
max_loops=1, | ||
multi_modal=True, | ||
) | ||
|
||
# Run agents with respective tasks | ||
haircut_suggestions = haircut_stylist_agent.run( | ||
"Suggest suitable haircuts for this user, considering their face shape and hair type.", user_selfie | ||
) | ||
|
||
# Run Makeup or Beard agent based on gender | ||
if user_gender == "woman": | ||
makeup_suggestions = makeup_or_beard_stylist_agent.run( | ||
"Recommend makeup styles for this user, complementing their features.", user_selfie | ||
) | ||
elif user_gender == "man": | ||
beard_suggestions = makeup_or_beard_stylist_agent.run( | ||
"Provide beard styling advice for this user, considering their face shape.", user_selfie | ||
) | ||
|
||
clothing_suggestions = clothing_stylist_agent.run( | ||
"Match clothing styles and colors for this user, using color matching principles.", clothes_image | ||
) | ||
|
||
accessories_suggestions = accessories_stylist_agent.run( | ||
"Suggest accessories to complement this user's outfit, considering the overall style.", clothes_image | ||
) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
HAIRCUT_STYLIST_AGENT_PROMPT = """ | ||
Objective: Provide personalized haircut suggestions based on the user's face shape, hair type, lifestyle, and personal preferences. | ||
- Analyze the user's face shape and hair type. | ||
- Consider the user's lifestyle and maintenance preferences. | ||
- Suggest multiple haircut options with explanations tailored to the user's unique features and needs. | ||
""" | ||
|
||
# Makeup Stylist Agent Prompt (for Women) | ||
MAKEUP_STYLIST_AGENT_PROMPT = """ | ||
Objective: Recommend makeup styles that complement the user's facial features, skin tone, and the occasion. | ||
- Identify key facial features such as eye shape, lip shape, skin type, and skin undertones. | ||
- Factor in current trends, personal style, and the occasion. | ||
- Provide a step-by-step makeup guide with product suggestions suitable for the user's skin type and tone. | ||
""" | ||
|
||
# Beard Stylist Agent Prompt (for Men) | ||
BEARD_STYLIST_AGENT_PROMPT = """ | ||
Objective: Offer beard styling advice tailored to the user's face shape, facial features, and grooming preferences. | ||
- Assess the user's face shape, beard density, and growth patterns. | ||
- Include maintenance tips and product recommendations. | ||
- Suggest various beard styles with guidance on achieving and maintaining them, suited to the user's facial structure. | ||
""" | ||
|
||
# Clothing Stylist Agent Prompt | ||
CLOTHING_STYLIST_AGENT_PROMPT = """ | ||
Objective: Match clothing styles and colors to the user's body type, complexion, and personal style preferences. | ||
- Evaluate the user's body shape, color palette preferences, and wardrobe elements. | ||
- Keep abreast of fashion trends while prioritizing comfort and confidence. | ||
- Curate outfits, explaining how each piece complements the user's physique and coloration, and suggest combinations. | ||
""" | ||
|
||
# Accessories Stylist Agent Prompt | ||
ACCESSORIES_STYLIST_AGENT_PROMPT = """ | ||
Objective: Suggest accessories that enhance the user's outfit for various occasions. | ||
- Analyze the outfit's style, color scheme, and the user's personal accessory preferences. | ||
- Balance trendiness with timelessness for versatile accessory choices. | ||
- Offer a range of accessory options with advice on pairing them with different outfits. | ||
""" |