Spaces:
Runtime error
Runtime error
File size: 7,201 Bytes
1c21e94 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 |
import gradio as gr
import random
# Predefined outfit components
OUTFIT_COMPONENTS = {
"tops": [
"Lace-trimmed crop top",
"Silk blouse with bow tie",
"Off-shoulder sweater",
"Ruffled poet shirt",
"Sheer mesh top",
"Velvet corset top",
"Satain camisole",
"Chiffon tunic",
"Fishnet top under sheer cover-up",
"Crop top with heart cutout",
"Transparent blouse with floral embroidery"
],
"bottoms": [
"High-waisted pleated skirt",
"Velvet mini skirt",
"Lace-up leather pants",
"Flowy maxi skirt",
"Pleated tennis skirt",
"High-waisted wide-leg trousers",
"Lace shorts with ribbon ties",
"Tiered ruffle skirt",
"Fishnet stockings under mini",
"Ripped skinny jeans",
"Silk wide-leg pants"
],
"accesories": [
"Choker with pendant",
"Lace gloves",
"Hair ribbons",
"Knee-high socks with lace trim",
"Charm bracelet set",
"Cat ears headband",
"Lace choker with heart lock",
"Pearl necklace",
"Fishnet arm sleeves",
"Velvet choker with cross",
"Sheer thigh-highs",
"Delicate anklet",
"Flower hair clip"
],
"footwear": [
"Mary Jane heels",
"Platform boots",
"Ballet flats with ribbons",
"Stokings with lace tops",
"Ankle boots with bows"
}
def generate_femboy_outfit(style_preference, color_palete):
"""Generate a beautiful femboy outfit based on user preferences"""
# Validate inputs
if not style_preference.strip():
return "Please enter your style preferences to generate an outfit."
# Generate random outfit
top = random.choice(OUTFIT_COMPONENTS["tops"])
bottom = random.choice(OUTFIT_COMPONENTS["bottoms"])
accecories = random.sample(OUTFIT_COMPONENTS["accesories"], k=3)
footwear = random.choice(OUTFIT_COMPONENTS["footwear"])
# Create outfit description
outfit = f"""
πΈ **Your Femboy Outfit Creation** πΈ
**Style Theme:** {style_preference}
**Color Palette:** {color_palete}
**Outfit Components:**
β’ **Top:** {top}
β’ **Bottom:** {bottom}
β’ **Footwear:** {footwear}
β’ **Accessories:** {', '.join(accecories)}
**Outfit Story:**
This enchanting ensemble combines delicate femininity with confident expression. The {color_palete} palette creates a harmonious balance that celebrates soft beauty while maintaining personal style.
π« **Outfit Vibe:** {random.choice(["Sweet Lolita", "Elegant Goth", "Soft Fairycore", "Kawaii Streetwear"])
**Styling Tips:**
β’ Pair with soft, natural makeup
β’ Add subtle floral perfume
β’ Style hair with soft waves or braids
"""
return outfit
def save_outfit(outfit_text):
"""Save the generated outfit to a file"""
if not outfit_text or "Please enter" in outfit_text:
return "No outfit to save. Please generate an outfit first."
try:
with open("generated_outfits.txt", "a", encoding="utf-8") as f:
f.write(f"\n{'='*50}\n")
f.write(outfit_text)
f.write(f"\n{'='*50}\n")
return "β¨ Outfit saved to 'generated_outfits.txt'!"
except Exception as e:
return f"β Error saving outfit: {str(e)}"
# Create custom theme for feminine aesthetics
feminine_theme = gr.themes.Soft(
primary_hue="pink",
secondary_hue="purple",
neutral_hue="slate",
font=gr.themes.GoogleFont("Playfair Display"),
text_size="lg",
spacing_size="lg",
radius_size="md"
).set(
button_primary_background_fill="*primary_500",
button_primary_background_fill_hover="*primary_600",
button_primary_text_color="white",
block_title_text_weight="600",
block_label_text_weight="500"
)
with gr.Blocks() as demo:
gr.Markdown(
"""
# πΈ Femboy Outfit Generator πΈ
*Create beautiful, feminine outfits that celebrate soft aesthetics and personal expression*
β¨ *Built with [anycoder](https://huggingface.co/spaces/akhaliq/anycoder) β¨
""",
elem_classes=["header-section"]
)
with gr.Row():
with gr.Column(scale=1):
gr.Markdown("### π Your Style Preferences")
style_preference = gr.Textbox(
label="Describe your desired style",
placeholder="e.g., soft fairycore, elegant goth, kawaii streetwear...",
lines=2,
placeholder="Share your aesthetic vision...",
elem_classes=["input-section"]
)
color_palete = gr.Dropdown(
choices=["Pastel Pinks", "Lavender Dreams", "Moonlight Silvers", "Rose Gold Elegance", "Velvet Romance"],
info="Be as detailed as you like! The more specific, the more personalized your outfit will be."
)
with gr.Row():
generate_btn = gr.Button(
"β¨ Generate Magical Outfit",
variant="primary",
elem_classes=["generate-button"]
)
with gr.Column(scale=1):
gr.Markdown("### π¨ Color Inspiration")
palette_examples = gr.Gallery(
label="Color Palette Inspirations",
columns=3,
height=200,
object_fit="cover",
elem_classes=["palette-section"]
)
with gr.Row():
outfit_output = gr.Markdown(
label="π Your Generatd Outfit",
value="**Your magical outfit awaits...** β¨",
elem_classes=["output-section"]
)
with gr.Row():
with gr.Column():
save_btn = gr.Button("πΎ Save This Outfit")
save_status = gr.Markdown("")
# Event listeners
generate_btn.click(
fn=generate_femboy_outfit,
inputs=[style_preference, color_palete],
outputs=[outfit_output],
api_visibility="public"
)
save_btn.click(
fn=save_outfit,
inputs=[outfit_output],
outputs=[save_status],
api_visibility="public"
)
if __name__ == "__main__":
demo.launch(
theme=feminine_theme,
css="""
.header-section {
text-align: center;
background: linear-gradient(135deg, #f9c5d1, #d5c6e0, #b8bedd"])
.gradio-container {
background: linear-gradient(135deg, #fef6ff, #f5f0ff, #e8e6ff"])
}
.generate-button {
background: linear-gradient(45deg, #ff85a2, #a28bff, #85a3ff"])
.input-section {
background: rgba(255, 255, 255, 0.8]);
backdrop-filter: blur(10px);
border-radius: 20px;
padding: 20px;
box-shadow: 0 8px 32px rgba(31, 38, 135, 0.37]);
border: 2px solid rgba(255, 255, 255, 0.5]);
}
""",
footer_links=[{"label": "β¨ Built with anycoder", "url": "https://huggingface.co/spaces/akhaliq/anycoder}]
) |