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