Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -333,53 +333,189 @@ train:
|
|
333 |
train_unet: true
|
334 |
'''
|
335 |
|
336 |
-
theme = gr.themes.Monochrome(
|
337 |
-
text_size=gr.themes.Size(lg="18px", md="15px", sm="13px", xl="22px", xs="12px", xxl="24px", xxs="9px"),
|
338 |
-
font=[gr.themes.GoogleFont("Source Sans Pro"), "ui-sans-serif", "system-ui", "sans-serif"],
|
339 |
-
)
|
340 |
|
341 |
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
.
|
348 |
-
""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
349 |
|
350 |
-
|
|
|
351 |
gr.Markdown(
|
352 |
"""# ๐ Gini LoRA ํ์ต
|
353 |
-
### ์ด๋ฏธ์ง๋ค(์ต๋ 150์ฅ ๋ฏธ๋ง)์ ์
๋ก๋ํ์ธ์.
|
354 |
)
|
355 |
|
356 |
-
with gr.Tab("Train"):
|
357 |
-
with gr.Column():
|
358 |
-
|
|
|
359 |
with gr.Row():
|
360 |
lora_name = gr.Textbox(
|
361 |
-
label="
|
362 |
-
info="
|
363 |
-
placeholder="
|
364 |
)
|
365 |
concept_sentence = gr.Textbox(
|
366 |
-
label="
|
367 |
-
info="
|
368 |
-
placeholder="
|
369 |
-
interactive=True,
|
370 |
)
|
371 |
-
|
372 |
model_warning = gr.Markdown(visible=False)
|
373 |
-
|
374 |
which_model = gr.Radio(
|
375 |
-
["[dev] (high quality model)"],
|
376 |
-
label="
|
377 |
value="[dev] (high quality model)"
|
378 |
)
|
379 |
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
with gr.Row():
|
384 |
images = gr.File(
|
385 |
file_types=["image", ".txt"],
|
|
|
333 |
train_unet: true
|
334 |
'''
|
335 |
|
|
|
|
|
|
|
|
|
336 |
|
337 |
|
338 |
+
# ํ
๋ง ์ค์ ๋ถ๋ถ์ ํ์ฌ ์ฝ๋์ ๋์ผํ๊ฒ ์์
|
339 |
+
custom_theme = gr.themes.Base(
|
340 |
+
primary_hue="blue",
|
341 |
+
secondary_hue="purple",
|
342 |
+
neutral_hue="slate",
|
343 |
+
).set(
|
344 |
+
button_primary_background_fill="*primary_500",
|
345 |
+
button_primary_background_fill_dark="*primary_600",
|
346 |
+
button_primary_background_fill_hover="*primary_400",
|
347 |
+
button_primary_border_color="*primary_500",
|
348 |
+
button_primary_border_color_dark="*primary_600",
|
349 |
+
button_primary_text_color="white",
|
350 |
+
button_primary_text_color_dark="white",
|
351 |
+
button_secondary_background_fill="*neutral_100",
|
352 |
+
button_secondary_background_fill_dark="*neutral_700",
|
353 |
+
button_secondary_background_fill_hover="*neutral_50",
|
354 |
+
button_secondary_text_color="*neutral_800",
|
355 |
+
button_secondary_text_color_dark="white",
|
356 |
+
background_fill_primary="*neutral_50",
|
357 |
+
background_fill_primary_dark="*neutral_900",
|
358 |
+
block_background_fill="white",
|
359 |
+
block_background_fill_dark="*neutral_800",
|
360 |
+
block_label_background_fill="*primary_500",
|
361 |
+
block_label_background_fill_dark="*primary_600",
|
362 |
+
block_label_text_color="white",
|
363 |
+
block_label_text_color_dark="white",
|
364 |
+
block_title_text_color="*neutral_800",
|
365 |
+
block_title_text_color_dark="white",
|
366 |
+
input_background_fill="white",
|
367 |
+
input_background_fill_dark="*neutral_800",
|
368 |
+
input_border_color="*neutral_200",
|
369 |
+
input_border_color_dark="*neutral_700",
|
370 |
+
input_placeholder_color="*neutral_400",
|
371 |
+
input_placeholder_color_dark="*neutral_400",
|
372 |
+
shadow_spread="8px",
|
373 |
+
shadow_inset="0px 2px 4px 0px rgba(0,0,0,0.05)"
|
374 |
+
)
|
375 |
+
|
376 |
+
# CSS ์คํ์ผ ํตํฉ
|
377 |
+
css = '''
|
378 |
+
/* ๊ธฐ๋ณธ ์คํ์ผ */
|
379 |
+
h1 {
|
380 |
+
font-size: 3em;
|
381 |
+
text-align: center;
|
382 |
+
margin-bottom: 0.5em;
|
383 |
+
}
|
384 |
+
|
385 |
+
h3 {
|
386 |
+
margin-top: 0;
|
387 |
+
font-size: 1.2em;
|
388 |
+
}
|
389 |
+
|
390 |
+
/* ์ปดํฌ๋ํธ ์คํ์ผ */
|
391 |
+
.container {
|
392 |
+
max-width: 1200px;
|
393 |
+
margin: 0 auto;
|
394 |
+
padding: 20px;
|
395 |
+
}
|
396 |
+
|
397 |
+
/* ์
๋ ฅ ํ๋ ์คํ์ผ */
|
398 |
+
.input-group {
|
399 |
+
background: var(--block-background-fill);
|
400 |
+
padding: 15px;
|
401 |
+
border-radius: 12px;
|
402 |
+
margin-bottom: 20px;
|
403 |
+
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
404 |
+
}
|
405 |
+
|
406 |
+
/* ๋ฒํผ ์คํ์ผ */
|
407 |
+
.button {
|
408 |
+
height: 40px;
|
409 |
+
border-radius: 8px;
|
410 |
+
transition: all 0.3s ease;
|
411 |
+
}
|
412 |
+
|
413 |
+
.button:hover {
|
414 |
+
transform: translateY(-2px);
|
415 |
+
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
|
416 |
+
}
|
417 |
+
|
418 |
+
/* ์ด๋ฏธ์ง ์
๋ก๋ ์์ญ */
|
419 |
+
.image-upload-area {
|
420 |
+
border: 2px dashed var(--input-border-color);
|
421 |
+
border-radius: 12px;
|
422 |
+
padding: 20px;
|
423 |
+
text-align: center;
|
424 |
+
margin-bottom: 20px;
|
425 |
+
}
|
426 |
+
|
427 |
+
/* ์บก์
์์ญ */
|
428 |
+
.caption-area {
|
429 |
+
background: var(--block-background-fill);
|
430 |
+
padding: 15px;
|
431 |
+
border-radius: 12px;
|
432 |
+
margin-top: 20px;
|
433 |
+
}
|
434 |
+
|
435 |
+
.caption-row {
|
436 |
+
display: flex;
|
437 |
+
align-items: center;
|
438 |
+
margin-bottom: 10px;
|
439 |
+
gap: 10px;
|
440 |
+
}
|
441 |
+
|
442 |
+
/* ๊ณ ๊ธ ์ต์
์์ญ */
|
443 |
+
.advanced-options {
|
444 |
+
background: var(--block-background-fill);
|
445 |
+
padding: 15px;
|
446 |
+
border-radius: 12px;
|
447 |
+
margin-top: 20px;
|
448 |
+
}
|
449 |
+
|
450 |
+
/* ์งํ ์ํ ํ์ */
|
451 |
+
.progress-area {
|
452 |
+
background: var(--block-background-fill);
|
453 |
+
padding: 15px;
|
454 |
+
border-radius: 12px;
|
455 |
+
margin-top: 20px;
|
456 |
+
text-align: center;
|
457 |
+
}
|
458 |
+
|
459 |
+
/* ๋ฐ์ํ ๋์์ธ */
|
460 |
+
@media (max-width: 768px) {
|
461 |
+
.caption-row {
|
462 |
+
flex-direction: column;
|
463 |
+
}
|
464 |
+
}
|
465 |
+
|
466 |
+
/* ์คํฌ๋กค๋ฐ ์คํ์ผ */
|
467 |
+
::-webkit-scrollbar {
|
468 |
+
width: 8px;
|
469 |
+
}
|
470 |
+
|
471 |
+
::-webkit-scrollbar-track {
|
472 |
+
background: var(--background-fill-primary);
|
473 |
+
border-radius: 4px;
|
474 |
+
}
|
475 |
+
|
476 |
+
::-webkit-scrollbar-thumb {
|
477 |
+
background: var(--primary-500);
|
478 |
+
border-radius: 4px;
|
479 |
+
}
|
480 |
+
|
481 |
+
::-webkit-scrollbar-thumb:hover {
|
482 |
+
background: var(--primary-600);
|
483 |
+
}
|
484 |
+
'''
|
485 |
|
486 |
+
# Gradio ์ฑ ์์
|
487 |
+
with gr.Blocks(theme=custom_theme, css=css) as demo:
|
488 |
gr.Markdown(
|
489 |
"""# ๐ Gini LoRA ํ์ต
|
490 |
+
### ์ด๋ฏธ์ง๋ค(์ต๋ 150์ฅ ๋ฏธ๋ง)์ ์
๋ก๋ํ์ธ์."""
|
491 |
)
|
492 |
|
493 |
+
with gr.Tab("Train"):
|
494 |
+
with gr.Column(elem_classes="container"):
|
495 |
+
# LoRA ์ค์ ๊ทธ๋ฃน
|
496 |
+
with gr.Group(elem_classes="input-group"):
|
497 |
with gr.Row():
|
498 |
lora_name = gr.Textbox(
|
499 |
+
label="LoRA ์ด๋ฆ",
|
500 |
+
info="๊ณ ์ ํ ์ด๋ฆ์ด์ด์ผ ํฉ๋๋ค",
|
501 |
+
placeholder="์: Persian Miniature Painting style, Cat Toy"
|
502 |
)
|
503 |
concept_sentence = gr.Textbox(
|
504 |
+
label="ํธ๋ฆฌ๊ฑฐ ๋จ์ด/๋ฌธ์ฅ",
|
505 |
+
info="์ฌ์ฉํ ํธ๋ฆฌ๊ฑฐ ๋จ์ด๋ ๋ฌธ์ฅ",
|
506 |
+
placeholder="p3rs0n์ด๋ trtcrd๊ฐ์ ํน์ดํ ๋จ์ด, ๋๋ 'in the style of CNSTLL'๊ฐ์ ๋ฌธ์ฅ"
|
|
|
507 |
)
|
508 |
+
|
509 |
model_warning = gr.Markdown(visible=False)
|
|
|
510 |
which_model = gr.Radio(
|
511 |
+
["[dev] (high quality model)"],
|
512 |
+
label="๊ธฐ๋ณธ ๋ชจ๋ธ",
|
513 |
value="[dev] (high quality model)"
|
514 |
)
|
515 |
|
516 |
+
# ์ด๋ฏธ์ง ์
๋ก๋ ์์ญ
|
517 |
+
with gr.Group(visible=True, elem_classes="image-upload-area") as image_upload:
|
518 |
+
|
519 |
with gr.Row():
|
520 |
images = gr.File(
|
521 |
file_types=["image", ".txt"],
|