ginipick commited on
Commit
4b8e8f5
Β·
verified Β·
1 Parent(s): 8c89a89

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +101 -104
app.py CHANGED
@@ -179,118 +179,115 @@ body {
179
  }
180
  """
181
 
182
- # Gradio μΈν„°νŽ˜μ΄μŠ€ ꡬ성
183
- with gr.Blocks(css=custom_css, theme="Yntec/HaleyCH_Theme_Orange") as app:
184
- with gr.Column(elem_classes="container"):
185
- gr.Markdown("# 🎭 Fashion Generation Studio", elem_classes="header")
186
-
187
- # λͺ¨λ“œ 선택
188
- with gr.Group(elem_classes="mode-box box-common"):
189
- mode = gr.Radio(
190
- choices=["Generate Model", "Generate Clothes"],
191
- label="Generation Mode",
192
- value="Generate Model"
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
- with gr.Group(elem_classes="parameter-box"):
274
- gr.Markdown("### 🎲 Seed Settings")
275
- with gr.Row():
276
- randomize_seed = gr.Checkbox(
277
- True,
278
- label="Randomize seed"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
279
  )
280
- seed = gr.Slider(
281
- label="Seed",
282
- minimum=0,
283
- maximum=MAX_SEED,
284
- step=1,
285
- value=42
 
 
 
 
 
 
 
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
- app.queue()
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)