Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -179,118 +179,115 @@ body {
|
|
| 179 |
}
|
| 180 |
"""
|
| 181 |
|
| 182 |
-
|
| 183 |
-
with gr.Blocks(
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
# ์ด๋ฏธ์ง ์ถ๋ ฅ ์์ญ
|
| 196 |
-
with gr.Group(elem_classes="result-box box-common"):
|
| 197 |
-
gr.Markdown("### ๐ผ๏ธ Generated Fashion")
|
| 198 |
-
result = gr.Image(label="Result", elem_classes="image-output")
|
| 199 |
-
|
| 200 |
-
# ํ๋กฌํํธ ์
๋ ฅ ์์ญ
|
| 201 |
-
with gr.Group(elem_classes="prompt-box box-common"):
|
| 202 |
-
prompt = gr.TextArea(
|
| 203 |
-
label="โ๏ธ Fashion Description (ํ๊ธ ๋๋ ์์ด)",
|
| 204 |
-
placeholder="ํจ์
๋ชจ๋ธ์ด๋ ์๋ฅ๋ฅผ ์ค๋ช
ํ์ธ์...",
|
| 205 |
-
lines=5
|
| 206 |
-
)
|
| 207 |
-
generate_button = gr.Button(
|
| 208 |
-
"๐ Generate Fashion",
|
| 209 |
-
elem_classes="generate-btn"
|
| 210 |
-
)
|
| 211 |
-
|
| 212 |
-
# ์์ ํญ
|
| 213 |
-
with gr.Tabs():
|
| 214 |
-
with gr.TabItem("Model Examples"):
|
| 215 |
-
gr.Examples(
|
| 216 |
-
examples=example_model_prompts,
|
| 217 |
-
inputs=prompt,
|
| 218 |
-
label="Model Prompts"
|
| 219 |
-
)
|
| 220 |
-
with gr.TabItem("Clothes Examples"):
|
| 221 |
-
gr.Examples(
|
| 222 |
-
examples=example_clothes_prompts,
|
| 223 |
-
inputs=prompt,
|
| 224 |
-
label="Clothes Prompts"
|
| 225 |
-
)
|
| 226 |
-
|
| 227 |
-
# ๊ณ ๊ธ ์ต์
|
| 228 |
-
with gr.Accordion("๐จ Advanced Options", open=False, elem_classes="accordion box-common"):
|
| 229 |
-
with gr.Group(elem_classes="parameter-box"):
|
| 230 |
-
gr.Markdown("### ๐๏ธ Generation Parameters")
|
| 231 |
-
with gr.Row():
|
| 232 |
-
with gr.Column():
|
| 233 |
-
cfg_scale = gr.Slider(
|
| 234 |
-
label="CFG Scale",
|
| 235 |
-
minimum=1,
|
| 236 |
-
maximum=20,
|
| 237 |
-
step=0.5,
|
| 238 |
-
value=7.0
|
| 239 |
-
)
|
| 240 |
-
steps = gr.Slider(
|
| 241 |
-
label="Steps",
|
| 242 |
-
minimum=1,
|
| 243 |
-
maximum=100,
|
| 244 |
-
step=1,
|
| 245 |
-
value=30
|
| 246 |
-
)
|
| 247 |
-
lora_scale = gr.Slider(
|
| 248 |
-
label="LoRA Scale",
|
| 249 |
-
minimum=0,
|
| 250 |
-
maximum=1,
|
| 251 |
-
step=0.01,
|
| 252 |
-
value=0.85
|
| 253 |
-
)
|
| 254 |
-
|
| 255 |
-
with gr.Group(elem_classes="parameter-box"):
|
| 256 |
-
gr.Markdown("### ๐ Image Dimensions")
|
| 257 |
-
with gr.Row():
|
| 258 |
-
width = gr.Slider(
|
| 259 |
-
label="Width",
|
| 260 |
-
minimum=256,
|
| 261 |
-
maximum=1536,
|
| 262 |
-
step=64,
|
| 263 |
-
value=512
|
| 264 |
-
)
|
| 265 |
-
height = gr.Slider(
|
| 266 |
-
label="Height",
|
| 267 |
-
minimum=256,
|
| 268 |
-
maximum=1536,
|
| 269 |
-
step=64,
|
| 270 |
-
value=768
|
| 271 |
)
|
| 272 |
-
|
| 273 |
-
|
| 274 |
-
|
| 275 |
-
|
| 276 |
-
|
| 277 |
-
|
| 278 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 279 |
)
|
| 280 |
-
|
| 281 |
-
|
| 282 |
-
|
| 283 |
-
|
| 284 |
-
|
| 285 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 286 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 287 |
|
| 288 |
# ์ด๋ฒคํธ ํธ๋ค๋ฌ
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 289 |
generate_button.click(
|
| 290 |
generate_fashion,
|
| 291 |
inputs=[prompt, mode, cfg_scale, steps, randomize_seed, seed, width, height, lora_scale],
|
| 292 |
outputs=[result, seed]
|
| 293 |
)
|
| 294 |
|
| 295 |
-
|
| 296 |
-
app.launch()
|
|
|
|
| 179 |
}
|
| 180 |
"""
|
| 181 |
|
| 182 |
+
|
| 183 |
+
with gr.Blocks(theme="Yntec/HaleyCH_Theme_Orange") as app:
|
| 184 |
+
gr.Markdown("# ๐ญ Fashion AI Studio")
|
| 185 |
+
gr.Markdown("Generate fashion images and try on virtual clothing using AI")
|
| 186 |
+
|
| 187 |
+
with gr.Tabs():
|
| 188 |
+
# Virtual Try-On ํญ
|
| 189 |
+
with gr.TabItem("๐ Virtual Try-On"):
|
| 190 |
+
with gr.Row():
|
| 191 |
+
with gr.Column():
|
| 192 |
+
prompt_input = gr.Textbox(
|
| 193 |
+
label="Style Description",
|
| 194 |
+
placeholder="Describe the desired style (e.g., 'person wearing elegant dress')"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 195 |
)
|
| 196 |
+
with gr.Row():
|
| 197 |
+
with gr.Group():
|
| 198 |
+
structure_image = gr.Image(
|
| 199 |
+
label="Your Photo (Full-body)",
|
| 200 |
+
type="filepath"
|
| 201 |
+
)
|
| 202 |
+
gr.Markdown("*Upload a clear, well-lit full-body photo*")
|
| 203 |
+
depth_strength = gr.Slider(
|
| 204 |
+
minimum=0,
|
| 205 |
+
maximum=50,
|
| 206 |
+
value=15,
|
| 207 |
+
label="Fitting Strength"
|
| 208 |
+
)
|
| 209 |
+
with gr.Group():
|
| 210 |
+
style_image = gr.Image(
|
| 211 |
+
label="Clothing Item",
|
| 212 |
+
type="filepath"
|
| 213 |
+
)
|
| 214 |
+
gr.Markdown("*Upload the clothing item you want to try on*")
|
| 215 |
+
style_strength = gr.Slider(
|
| 216 |
+
minimum=0,
|
| 217 |
+
maximum=1,
|
| 218 |
+
value=0.5,
|
| 219 |
+
label="Style Transfer Strength"
|
| 220 |
+
)
|
| 221 |
+
tryon_btn = gr.Button("Generate Try-On")
|
| 222 |
+
|
| 223 |
+
gr.Examples(
|
| 224 |
+
examples=examples,
|
| 225 |
+
inputs=[prompt_input, structure_image, style_image, depth_strength, style_strength],
|
| 226 |
+
outputs=[output_image],
|
| 227 |
+
fn=generate_image,
|
| 228 |
+
cache_examples=True
|
| 229 |
)
|
| 230 |
+
|
| 231 |
+
with gr.Column():
|
| 232 |
+
output_image.render()
|
| 233 |
+
|
| 234 |
+
# Fashion Generation ํญ
|
| 235 |
+
with gr.TabItem("๐ Fashion Generation"):
|
| 236 |
+
with gr.Column():
|
| 237 |
+
# ๋ชจ๋ ์ ํ
|
| 238 |
+
with gr.Group():
|
| 239 |
+
mode = gr.Radio(
|
| 240 |
+
choices=["Generate Model", "Generate Clothes"],
|
| 241 |
+
label="Generation Mode",
|
| 242 |
+
value="Generate Model"
|
| 243 |
)
|
| 244 |
+
|
| 245 |
+
# ํ๋กฌํํธ ์
๋ ฅ
|
| 246 |
+
prompt = gr.TextArea(
|
| 247 |
+
label="โ๏ธ Fashion Description (ํ๊ธ ๋๋ ์์ด)",
|
| 248 |
+
placeholder="ํจ์
๋ชจ๋ธ์ด๋ ์๋ฅ๋ฅผ ์ค๋ช
ํ์ธ์...",
|
| 249 |
+
lines=5
|
| 250 |
+
)
|
| 251 |
+
|
| 252 |
+
# ๊ฒฐ๊ณผ ์ด๋ฏธ์ง
|
| 253 |
+
result = gr.Image(label="Generated Fashion")
|
| 254 |
+
|
| 255 |
+
generate_button = gr.Button("๐ Generate Fashion")
|
| 256 |
+
|
| 257 |
+
# ๊ณ ๊ธ ์ค์ ์์ฝ๋์ธ
|
| 258 |
+
with gr.Accordion("๐จ Advanced Options", open=False):
|
| 259 |
+
with gr.Row():
|
| 260 |
+
cfg_scale = gr.Slider(label="CFG Scale", minimum=1, maximum=20, value=7.0)
|
| 261 |
+
steps = gr.Slider(label="Steps", minimum=1, maximum=100, value=30)
|
| 262 |
+
lora_scale = gr.Slider(label="LoRA Scale", minimum=0, maximum=1, value=0.85)
|
| 263 |
+
|
| 264 |
+
with gr.Row():
|
| 265 |
+
width = gr.Slider(label="Width", minimum=256, maximum=1536, value=512)
|
| 266 |
+
height = gr.Slider(label="Height", minimum=256, maximum=1536, value=768)
|
| 267 |
+
|
| 268 |
+
with gr.Row():
|
| 269 |
+
randomize_seed = gr.Checkbox(True, label="Randomize seed")
|
| 270 |
+
seed = gr.Slider(label="Seed", minimum=0, maximum=MAX_SEED, value=42)
|
| 271 |
+
|
| 272 |
+
# ์์ ํญ
|
| 273 |
+
with gr.Tabs():
|
| 274 |
+
with gr.TabItem("Model Examples"):
|
| 275 |
+
gr.Examples(examples=example_model_prompts, inputs=prompt)
|
| 276 |
+
with gr.TabItem("Clothes Examples"):
|
| 277 |
+
gr.Examples(examples=example_clothes_prompts, inputs=prompt)
|
| 278 |
|
| 279 |
# ์ด๋ฒคํธ ํธ๋ค๋ฌ
|
| 280 |
+
tryon_btn.click(
|
| 281 |
+
fn=generate_image,
|
| 282 |
+
inputs=[prompt_input, structure_image, style_image, depth_strength, style_strength],
|
| 283 |
+
outputs=[output_image]
|
| 284 |
+
)
|
| 285 |
+
|
| 286 |
generate_button.click(
|
| 287 |
generate_fashion,
|
| 288 |
inputs=[prompt, mode, cfg_scale, steps, randomize_seed, seed, width, height, lora_scale],
|
| 289 |
outputs=[result, seed]
|
| 290 |
)
|
| 291 |
|
| 292 |
+
if __name__ == "__main__":
|
| 293 |
+
app.launch(share=True)
|