Text2Face / promptgen.py
oguzhanercan's picture
Upload promptgen.py
816ed11 verified
import random
# Helper functions for random features
def short_random_hair():
styles = ["long", "short", "shoulder-length", "buzzed", "medium-length", "curly", "straight", "wavy"]
colors = ["black", "brown", "blonde", "red", "gray", "white", "auburn", "golden"]
return f"{random.choice(styles)} {random.choice(colors)} hair"
def short_random_skin():
tones = ["fair", "light", "medium", "tan", "brown", "dark", "golden"]
return f"{random.choice(tones)} skin"
def short_random_face_structure():
shapes = ["oval face", "square face", "round face", "heart-shaped face", "diamond face"]
return random.choice(shapes)
def short_random_eyes():
colors = ["brown", "blue", "green", "gray", "hazel"]
return f"{random.choice(colors)} eyes"
def short_random_eyebrows():
types = ["arched", "thick", "thin", "rounded", "bushy"]
return f"{random.choice(types)} eyebrows"
def short_random_nose():
sizes = ["small nose", "medium nose", "large nose"]
return random.choice(sizes)
def short_random_mouth():
types = ["small lips", "full lips", "thin lips"]
return random.choice(types)
def short_random_facial_hair():
options = ["clean-shaven", "beard", "mustache", "stubble", "no facial hair"]
return random.choice(options)
def random_age():
return f"{random.randint(18, 75)}-year-old"
def random_gender():
return random.choice(["male", "female"])
def random_race():
return random.choice(["Caucasian", "African", "Asian", "Hispanic", "Middle Eastern",
"Native American", "Mixed race", "Pacific Islander", "South Asian", "Indigenous"])
# Generate 1000 shortened prompts
shortened_prompts = []
for _ in range(100000):
prompt = (
f"A {random_age()} {random_gender()} with {short_random_hair()}, {short_random_skin()}, "
f"{short_random_face_structure()}, {short_random_eyes()}, {short_random_eyebrows()}, "
f"{short_random_nose()}, {short_random_mouth()}, {short_random_facial_hair()}. "
f"Race: {random_race()}."
)
shortened_prompts.append(prompt)
# Save to a text file
file_path = "shortened_facial_description_prompts.txt"
with open(file_path, "w") as f:
for prompt in shortened_prompts:
f.write(prompt + "\n")
print(f"Prompts saved to {file_path}")