openfree commited on
Commit
b512e1d
ยท
verified ยท
1 Parent(s): 63b602e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +166 -30
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
- css = """
343
- h1{font-size: 2em}
344
- h3{margin-top: 0}
345
- #component-1{text-align:center}
346
- .tabitem{border: 0px}
347
- .group_padding{padding: .55em}
348
- """
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
349
 
350
- with gr.Blocks(theme=theme, css=css) as demo:
 
351
  gr.Markdown(
352
  """# ๐Ÿ†” Gini LoRA ํ•™์Šต
353
- ### ์ด๋ฏธ์ง€๋“ค(์ตœ๋Œ€ 150์žฅ ๋ฏธ๋งŒ)์„ ์—…๋กœ๋“œํ•˜์„ธ์š”. """
354
  )
355
 
356
- with gr.Tab("Train"): # ํƒญ ์ด๋ฆ„ ๋ณ€๊ฒฝ
357
- with gr.Column(): # main_ui ๋Œ€์‹  ์ง์ ‘ Column ์‚ฌ์šฉ
358
- with gr.Group():
 
359
  with gr.Row():
360
  lora_name = gr.Textbox(
361
- label="The name of your LoRA",
362
- info="This has to be a unique name",
363
- placeholder="e.g.: Persian Miniature Painting style, Cat Toy",
364
  )
365
  concept_sentence = gr.Textbox(
366
- label="Trigger word/sentence",
367
- info="Trigger word or sentence to be used",
368
- placeholder="uncommon word like p3rs0n or trtcrd, or sentence like 'in the style of CNSTLL'",
369
- interactive=True,
370
  )
371
- # model_warning ๋ณ€์ˆ˜ ์ถ”๊ฐ€
372
  model_warning = gr.Markdown(visible=False)
373
-
374
  which_model = gr.Radio(
375
- ["[dev] (high quality model)"],
376
- label="Base model",
377
  value="[dev] (high quality model)"
378
  )
379
 
380
-
381
-
382
- with gr.Group(visible=True) as image_upload:
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"],