Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -23,19 +23,6 @@ pipe.to("cuda")
|
|
| 23 |
|
| 24 |
MAX_SEED = 2**32-1
|
| 25 |
|
| 26 |
-
# ์์ ์ค์
|
| 27 |
-
example_model_prompts = [
|
| 28 |
-
"professional fashion model, full body shot, standing pose, natural lighting, studio background, high fashion, elegant pose",
|
| 29 |
-
"fashion model portrait, upper body, confident pose, fashion photography, neutral background, professional lighting",
|
| 30 |
-
"stylish fashion model, three-quarter view, editorial pose, high-end fashion magazine style, minimal background"
|
| 31 |
-
]
|
| 32 |
-
|
| 33 |
-
example_clothes_prompts = [
|
| 34 |
-
"luxury designer sweater, cashmere material, cream color, cable knit pattern, high-end fashion, product photography",
|
| 35 |
-
"elegant business blazer, tailored fit, charcoal grey, premium wool fabric, professional wear",
|
| 36 |
-
"modern streetwear hoodie, oversized fit, minimalist design, premium cotton, urban style"
|
| 37 |
-
]
|
| 38 |
-
|
| 39 |
@spaces.GPU()
|
| 40 |
def generate_fashion(prompt, mode, cfg_scale, steps, randomize_seed, seed, width, height, lora_scale, progress=gr.Progress(track_tqdm=True)):
|
| 41 |
# ํ๊ธ ๊ฐ์ง ๋ฐ ๋ฒ์ญ
|
|
@@ -79,106 +66,9 @@ def generate_fashion(prompt, mode, cfg_scale, steps, randomize_seed, seed, width
|
|
| 79 |
progress(100, "Completed!")
|
| 80 |
return image, seed
|
| 81 |
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
background-color: #f5f5f5;
|
| 86 |
-
font-family: 'Arial', sans-serif;
|
| 87 |
-
}
|
| 88 |
-
|
| 89 |
-
.container {
|
| 90 |
-
max-width: 1200px;
|
| 91 |
-
margin: 0 auto;
|
| 92 |
-
padding: 20px;
|
| 93 |
-
}
|
| 94 |
-
|
| 95 |
-
.header {
|
| 96 |
-
text-align: center;
|
| 97 |
-
color: #333;
|
| 98 |
-
margin-bottom: 30px;
|
| 99 |
-
font-size: 2.5em;
|
| 100 |
-
text-transform: uppercase;
|
| 101 |
-
letter-spacing: 2px;
|
| 102 |
-
}
|
| 103 |
-
|
| 104 |
-
.box-common {
|
| 105 |
-
background-color: white;
|
| 106 |
-
border-radius: 15px;
|
| 107 |
-
padding: 25px;
|
| 108 |
-
margin: 20px 0;
|
| 109 |
-
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
| 110 |
-
}
|
| 111 |
-
|
| 112 |
-
.mode-box {
|
| 113 |
-
background-color: #fff;
|
| 114 |
-
padding: 20px;
|
| 115 |
-
border-radius: 10px;
|
| 116 |
-
margin-bottom: 20px;
|
| 117 |
-
border: 2px solid #eee;
|
| 118 |
-
}
|
| 119 |
-
|
| 120 |
-
.result-box {
|
| 121 |
-
width: 90%;
|
| 122 |
-
max-width: 1000px;
|
| 123 |
-
margin: 20px auto;
|
| 124 |
-
}
|
| 125 |
-
|
| 126 |
-
.image-output {
|
| 127 |
-
width: 100%;
|
| 128 |
-
max-width: 800px;
|
| 129 |
-
margin: 0 auto;
|
| 130 |
-
display: block;
|
| 131 |
-
}
|
| 132 |
-
|
| 133 |
-
.prompt-box {
|
| 134 |
-
width: 90%;
|
| 135 |
-
max-width: 1000px;
|
| 136 |
-
margin: 20px auto;
|
| 137 |
-
}
|
| 138 |
-
|
| 139 |
-
.generate-btn {
|
| 140 |
-
background: linear-gradient(45deg, #ff6b6b, #ff8e8e) !important;
|
| 141 |
-
color: white !important;
|
| 142 |
-
padding: 15px 30px !important;
|
| 143 |
-
border-radius: 8px !important;
|
| 144 |
-
border: none !important;
|
| 145 |
-
font-size: 1.1em !important;
|
| 146 |
-
cursor: pointer !important;
|
| 147 |
-
transition: all 0.3s ease !important;
|
| 148 |
-
width: 250px !important;
|
| 149 |
-
margin: 20px auto !important;
|
| 150 |
-
display: block !important;
|
| 151 |
-
text-transform: uppercase !important;
|
| 152 |
-
letter-spacing: 1px !important;
|
| 153 |
-
}
|
| 154 |
-
|
| 155 |
-
.generate-btn:hover {
|
| 156 |
-
background: linear-gradient(45deg, #ff8e8e, #ff6b6b) !important;
|
| 157 |
-
transform: translateY(-2px) !important;
|
| 158 |
-
box-shadow: 0 5px 15px rgba(255, 107, 107, 0.4) !important;
|
| 159 |
-
}
|
| 160 |
-
|
| 161 |
-
.accordion {
|
| 162 |
-
width: 90%;
|
| 163 |
-
max-width: 1000px;
|
| 164 |
-
margin: 20px auto;
|
| 165 |
-
}
|
| 166 |
-
|
| 167 |
-
.examples-table {
|
| 168 |
-
background-color: rgba(255, 255, 255, 0.95);
|
| 169 |
-
border-radius: 8px;
|
| 170 |
-
padding: 15px;
|
| 171 |
-
margin-top: 20px;
|
| 172 |
-
}
|
| 173 |
-
|
| 174 |
-
.parameter-box {
|
| 175 |
-
background-color: #f8f9fa;
|
| 176 |
-
padding: 20px;
|
| 177 |
-
border-radius: 8px;
|
| 178 |
-
margin: 10px 0;
|
| 179 |
-
}
|
| 180 |
-
"""
|
| 181 |
-
|
| 182 |
|
| 183 |
with gr.Blocks(theme="Yntec/HaleyCH_Theme_Orange") as app:
|
| 184 |
gr.Markdown("# ๐ญ Fashion AI Studio")
|
|
@@ -219,17 +109,9 @@ with gr.Blocks(theme="Yntec/HaleyCH_Theme_Orange") as app:
|
|
| 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.
|
| 233 |
|
| 234 |
# Fashion Generation ํญ
|
| 235 |
with gr.TabItem("๐ Fashion Generation"):
|
|
@@ -269,13 +151,6 @@ with gr.Blocks(theme="Yntec/HaleyCH_Theme_Orange") as app:
|
|
| 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,
|
|
|
|
| 23 |
|
| 24 |
MAX_SEED = 2**32-1
|
| 25 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
@spaces.GPU()
|
| 27 |
def generate_fashion(prompt, mode, cfg_scale, steps, randomize_seed, seed, width, height, lora_scale, progress=gr.Progress(track_tqdm=True)):
|
| 28 |
# ํ๊ธ ๊ฐ์ง ๋ฐ ๋ฒ์ญ
|
|
|
|
| 66 |
progress(100, "Completed!")
|
| 67 |
return image, seed
|
| 68 |
|
| 69 |
+
def generate_image(prompt, structure_image, style_image, depth_strength, style_strength):
|
| 70 |
+
# ์ค์ ์ด๋ฏธ์ง ์์ฑ ๋ก์ง์ ์ฌ๊ธฐ์ ๊ตฌํ
|
| 71 |
+
return Image.new('RGB', (512, 512), 'white')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
|
| 73 |
with gr.Blocks(theme="Yntec/HaleyCH_Theme_Orange") as app:
|
| 74 |
gr.Markdown("# ๐ญ Fashion AI Studio")
|
|
|
|
| 109 |
label="Style Transfer Strength"
|
| 110 |
)
|
| 111 |
tryon_btn = gr.Button("Generate Try-On")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 112 |
|
| 113 |
with gr.Column():
|
| 114 |
+
output_image = gr.Image(label="Generated Result")
|
| 115 |
|
| 116 |
# Fashion Generation ํญ
|
| 117 |
with gr.TabItem("๐ Fashion Generation"):
|
|
|
|
| 151 |
randomize_seed = gr.Checkbox(True, label="Randomize seed")
|
| 152 |
seed = gr.Slider(label="Seed", minimum=0, maximum=MAX_SEED, value=42)
|
| 153 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 154 |
# ์ด๋ฒคํธ ํธ๋ค๋ฌ
|
| 155 |
tryon_btn.click(
|
| 156 |
fn=generate_image,
|