Update app.py
Browse files
app.py
CHANGED
|
@@ -195,83 +195,77 @@ def infer_pose(prompt,
|
|
| 195 |
).images[0]
|
| 196 |
return [condi_img, image], seed
|
| 197 |
|
|
|
|
| 198 |
canny_examples = [
|
| 199 |
-
["
|
| 200 |
"image/woman_1.png"],
|
| 201 |
-
["
|
| 202 |
"image/dog.png"]
|
| 203 |
]
|
| 204 |
|
| 205 |
depth_examples = [
|
| 206 |
-
["
|
| 207 |
"image/woman_2.png"],
|
| 208 |
-
["
|
| 209 |
"image/bird.png"]
|
| 210 |
]
|
| 211 |
|
| 212 |
pose_examples = [
|
| 213 |
-
["
|
| 214 |
"image/woman_3.png"],
|
| 215 |
-
["
|
| 216 |
"image/woman_4.png"]
|
| 217 |
]
|
| 218 |
|
| 219 |
-
css="""
|
| 220 |
-
|
| 221 |
-
|
| 222 |
-
max-width: 600px;
|
| 223 |
-
}
|
| 224 |
-
#col-right {
|
| 225 |
-
margin: 0 auto;
|
| 226 |
-
max-width: 750px;
|
| 227 |
-
}
|
| 228 |
-
#button {
|
| 229 |
-
color: blue;
|
| 230 |
}
|
| 231 |
"""
|
| 232 |
|
|
|
|
| 233 |
def load_description(fp):
|
| 234 |
with open(fp, 'r', encoding='utf-8') as f:
|
| 235 |
content = f.read()
|
| 236 |
return content
|
| 237 |
|
| 238 |
-
with gr.Blocks(css=css) as Kolors:
|
| 239 |
gr.HTML(load_description("assets/title.md"))
|
| 240 |
with gr.Row():
|
| 241 |
with gr.Column(elem_id="col-left"):
|
| 242 |
with gr.Row():
|
| 243 |
prompt = gr.Textbox(
|
| 244 |
-
label="
|
| 245 |
-
placeholder="
|
| 246 |
lines=2
|
| 247 |
)
|
| 248 |
with gr.Row():
|
| 249 |
-
image = gr.Image(label="
|
| 250 |
-
with gr.Accordion("
|
| 251 |
negative_prompt = gr.Textbox(
|
| 252 |
-
label="
|
| 253 |
-
placeholder="
|
| 254 |
visible=True,
|
| 255 |
-
value="nsfw
|
| 256 |
)
|
| 257 |
seed = gr.Slider(
|
| 258 |
-
label="
|
| 259 |
minimum=0,
|
| 260 |
maximum=MAX_SEED,
|
| 261 |
step=1,
|
| 262 |
value=0,
|
| 263 |
)
|
| 264 |
-
randomize_seed = gr.Checkbox(label="
|
| 265 |
with gr.Row():
|
| 266 |
guidance_scale = gr.Slider(
|
| 267 |
-
label="
|
| 268 |
minimum=0.0,
|
| 269 |
maximum=10.0,
|
| 270 |
step=0.1,
|
| 271 |
value=6.0,
|
| 272 |
)
|
| 273 |
num_inference_steps = gr.Slider(
|
| 274 |
-
label="
|
| 275 |
minimum=10,
|
| 276 |
maximum=50,
|
| 277 |
step=1,
|
|
@@ -279,14 +273,14 @@ with gr.Blocks(css=css) as Kolors:
|
|
| 279 |
)
|
| 280 |
with gr.Row():
|
| 281 |
controlnet_conditioning_scale = gr.Slider(
|
| 282 |
-
label="
|
| 283 |
minimum=0.0,
|
| 284 |
maximum=1.0,
|
| 285 |
step=0.1,
|
| 286 |
value=0.7,
|
| 287 |
)
|
| 288 |
control_guidance_end = gr.Slider(
|
| 289 |
-
label="
|
| 290 |
minimum=0.0,
|
| 291 |
maximum=1.0,
|
| 292 |
step=0.1,
|
|
@@ -294,20 +288,22 @@ with gr.Blocks(css=css) as Kolors:
|
|
| 294 |
)
|
| 295 |
with gr.Row():
|
| 296 |
strength = gr.Slider(
|
| 297 |
-
label="
|
| 298 |
minimum=0.0,
|
| 299 |
maximum=1.0,
|
| 300 |
step=0.1,
|
| 301 |
value=1.0,
|
| 302 |
)
|
| 303 |
with gr.Row():
|
| 304 |
-
canny_button = gr.Button("
|
| 305 |
-
depth_button = gr.Button("
|
| 306 |
-
pose_button = gr.Button("
|
| 307 |
|
| 308 |
with gr.Column(elem_id="col-right"):
|
| 309 |
-
result = gr.Gallery(label="
|
| 310 |
-
seed_used = gr.Number(label="
|
|
|
|
|
|
|
| 311 |
|
| 312 |
with gr.Row():
|
| 313 |
gr.Examples(
|
|
|
|
| 195 |
).images[0]
|
| 196 |
return [condi_img, image], seed
|
| 197 |
|
| 198 |
+
|
| 199 |
canny_examples = [
|
| 200 |
+
["์๋ฆ๋ค์ด ์๋
, ๊ณ ํ์ง, ๋งค์ฐ ์ ๋ช
, ์์ํ ์์, ์ด๊ณ ํด์๋, ์ต์์ ํ์ง, 8k, ๊ณ ํ์ง, 4K",
|
| 201 |
"image/woman_1.png"],
|
| 202 |
+
["ํ๋
ธ๋ผ๋ง, ์ปต ์์ ์์์๋ ๊ท์ฌ์ด ํฐ ๊ฐ์์ง, ์นด๋ฉ๋ผ๋ฅผ ๋ฐ๋ผ๋ณด๋, ์ ๋๋ฉ์ด์
์คํ์ผ, 3D ๋ ๋๋ง, ์ฅํ
์ธ ๋ ๋",
|
| 203 |
"image/dog.png"]
|
| 204 |
]
|
| 205 |
|
| 206 |
depth_examples = [
|
| 207 |
+
["์ ์นด์ด ๋ง์ฝํ ์คํ์ผ, ํ๋ถํ ์๊ฐ, ์ด๋ก ์
์ธ ๋ฅผ ์
์ ์ฌ์ฑ์ด ๋คํ์ ์ ์๋, ์๋ฆ๋ค์ด ํ๊ฒฝ, ๋ง๊ณ ๋ฐ์, ์ผ๋ฃฉ์ง ๋น๊ณผ ๊ทธ๋ฆผ์, ์ต๊ณ ์ ํ์ง, ์ด์ธ๋ฐ, 8K ํ์ง",
|
| 208 |
"image/woman_2.png"],
|
| 209 |
+
["ํ๋ คํ ์์์ ์์ ์, ๊ณ ํ์ง, ๋งค์ฐ ์ ๋ช
, ์์ํ ์์, ์ด๊ณ ํด์๋, ์ต์์ ํ์ง, 8k, ๊ณ ํ์ง, 4K",
|
| 210 |
"image/bird.png"]
|
| 211 |
]
|
| 212 |
|
| 213 |
pose_examples = [
|
| 214 |
+
["๋ณด๋ผ์ ํผํ ์ฌ๋ฆฌ๋ธ ๋๋ ์ค๋ฅผ ์
๊ณ ์๊ด๊ณผ ํฐ์ ๋ ์ด์ค ์ฅ๊ฐ์ ๋ ์๋
๊ฐ ์ ์์ผ๋ก ์ผ๊ตด์ ๊ฐ์ธ๊ณ ์๋, ๊ณ ํ์ง, ๋งค์ฐ ์ ๋ช
, ์์ํ ์์, ์ด๊ณ ํด์๋, ์ต์์ ํ์ง, 8k, ๊ณ ํ์ง, 4K",
|
| 215 |
"image/woman_3.png"],
|
| 216 |
+
["๊ฒ์์ ์คํฌ์ธ ์ฌํท๊ณผ ํฐ์ ์ด๋๋ฅผ ์
๊ณ ๋ชฉ๊ฑธ์ด๋ฅผ ํ ์ฌ์ฑ์ด ๊ฑฐ๋ฆฌ์ ์ ์๋, ๋ฐฐ๊ฒฝ์ ๋นจ๊ฐ ๊ฑด๋ฌผ๊ณผ ๋
น์ ๋๋ฌด, ๊ณ ํ์ง, ๋งค์ฐ ์ ๋ช
, ์์ํ ์์, ์ด๊ณ ํด์๋, ์ต์์ ํ์ง, 8k, ๊ณ ํ์ง, 4K",
|
| 217 |
"image/woman_4.png"]
|
| 218 |
]
|
| 219 |
|
| 220 |
+
css = """
|
| 221 |
+
footer {
|
| 222 |
+
visibility: hidden;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 223 |
}
|
| 224 |
"""
|
| 225 |
|
| 226 |
+
|
| 227 |
def load_description(fp):
|
| 228 |
with open(fp, 'r', encoding='utf-8') as f:
|
| 229 |
content = f.read()
|
| 230 |
return content
|
| 231 |
|
| 232 |
+
with gr.Blocks(theme="Nymbo/Nymbo_Theme", css=css) as Kolors:
|
| 233 |
gr.HTML(load_description("assets/title.md"))
|
| 234 |
with gr.Row():
|
| 235 |
with gr.Column(elem_id="col-left"):
|
| 236 |
with gr.Row():
|
| 237 |
prompt = gr.Textbox(
|
| 238 |
+
label="ํ๋กฌํํธ",
|
| 239 |
+
placeholder="ํ๋กฌํํธ๋ฅผ ์
๋ ฅํ์ธ์",
|
| 240 |
lines=2
|
| 241 |
)
|
| 242 |
with gr.Row():
|
| 243 |
+
image = gr.Image(label="์ด๋ฏธ์ง", type="pil")
|
| 244 |
+
with gr.Accordion("๊ณ ๊ธ ์ค์ ", open=False):
|
| 245 |
negative_prompt = gr.Textbox(
|
| 246 |
+
label="๋ค๊ฑฐํฐ๋ธ ํ๋กฌํํธ",
|
| 247 |
+
placeholder="๋ค๊ฑฐํฐ๋ธ ํ๋กฌํํธ๋ฅผ ์
๋ ฅํ์ธ์",
|
| 248 |
visible=True,
|
| 249 |
+
value="nsfw, ์ผ๊ตด ๊ทธ๋ฆผ์, ์ ํด์๋, jpeg ์ํฐํฉํธ, ํ๋ฆฟํจ, ์ด์
ํจ, ๊ฒ์ ์ผ๊ตด, ๋ค์จ ์กฐ๋ช
"
|
| 250 |
)
|
| 251 |
seed = gr.Slider(
|
| 252 |
+
label="์๋",
|
| 253 |
minimum=0,
|
| 254 |
maximum=MAX_SEED,
|
| 255 |
step=1,
|
| 256 |
value=0,
|
| 257 |
)
|
| 258 |
+
randomize_seed = gr.Checkbox(label="์๋ ๋ฌด์์ํ", value=True)
|
| 259 |
with gr.Row():
|
| 260 |
guidance_scale = gr.Slider(
|
| 261 |
+
label="๊ฐ์ด๋์ค ์ค์ผ์ผ",
|
| 262 |
minimum=0.0,
|
| 263 |
maximum=10.0,
|
| 264 |
step=0.1,
|
| 265 |
value=6.0,
|
| 266 |
)
|
| 267 |
num_inference_steps = gr.Slider(
|
| 268 |
+
label="์ถ๋ก ๋จ๊ณ ์",
|
| 269 |
minimum=10,
|
| 270 |
maximum=50,
|
| 271 |
step=1,
|
|
|
|
| 273 |
)
|
| 274 |
with gr.Row():
|
| 275 |
controlnet_conditioning_scale = gr.Slider(
|
| 276 |
+
label="์ปจํธ๋กค๋ท ์ปจ๋์
๋ ์ค์ผ์ผ",
|
| 277 |
minimum=0.0,
|
| 278 |
maximum=1.0,
|
| 279 |
step=0.1,
|
| 280 |
value=0.7,
|
| 281 |
)
|
| 282 |
control_guidance_end = gr.Slider(
|
| 283 |
+
label="์ปจํธ๋กค ๊ฐ์ด๋์ค ์ข
๋ฃ",
|
| 284 |
minimum=0.0,
|
| 285 |
maximum=1.0,
|
| 286 |
step=0.1,
|
|
|
|
| 288 |
)
|
| 289 |
with gr.Row():
|
| 290 |
strength = gr.Slider(
|
| 291 |
+
label="๊ฐ๋",
|
| 292 |
minimum=0.0,
|
| 293 |
maximum=1.0,
|
| 294 |
step=0.1,
|
| 295 |
value=1.0,
|
| 296 |
)
|
| 297 |
with gr.Row():
|
| 298 |
+
canny_button = gr.Button("์บ๋", elem_id="button")
|
| 299 |
+
depth_button = gr.Button("๊น์ด", elem_id="button")
|
| 300 |
+
pose_button = gr.Button("ํฌ์ฆ", elem_id="button")
|
| 301 |
|
| 302 |
with gr.Column(elem_id="col-right"):
|
| 303 |
+
result = gr.Gallery(label="๊ฒฐ๊ณผ", show_label=False, columns=2)
|
| 304 |
+
seed_used = gr.Number(label="์ฌ์ฉ๋ ์๋")
|
| 305 |
+
|
| 306 |
+
|
| 307 |
|
| 308 |
with gr.Row():
|
| 309 |
gr.Examples(
|