Kims12 commited on
Commit
4e988f9
ยท
verified ยท
1 Parent(s): 5c1dc59

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -23
app.py CHANGED
@@ -460,7 +460,7 @@ def update_background_style_options(background_type):
460
  else:
461
  return gr.update(choices=["์„ ํƒํ•˜์„ธ์š”"], value="์„ ํƒํ•˜์„ธ์š”")
462
 
463
- # Gradio ์ธํ„ฐํŽ˜์ด์Šค
464
  with gr.Blocks() as demo:
465
  gr.HTML(
466
  """
@@ -487,11 +487,11 @@ with gr.Blocks() as demo:
487
  )
488
 
489
  with gr.Row():
490
- image_change_btn = gr.Button("์ด๋ฏธ์ง€ ๋ณ€๊ฒฝ")
491
- text_remove_btn = gr.Button("๊ธ€์ž์ง€์šฐ๊ธฐ")
492
- clothes_change_btn = gr.Button("์˜ท๋ฐ”๊พธ๊ธฐ")
493
- background_change_btn = gr.Button("๋ฐฐ๊ฒฝ๋ฐ”๊พธ๊ธฐ", variant="primary")
494
- composite_product_btn = gr.Button("์ƒํ’ˆํ•ฉ์„ฑ")
495
 
496
  # ๋ฐฐ๊ฒฝ ๋ณ€๊ฒฝ ๊ด€๋ จ ์„น์…˜ (๊ธฐ๋ณธ์ ์œผ๋กœ ์ˆจ๊น€ ์ƒํƒœ)
497
  with gr.Row(visible=False) as background_header:
@@ -571,12 +571,11 @@ with gr.Blocks() as demo:
571
  visible=False
572
  )
573
 
574
- # ๋ฒ„ํŠผ๋“ค์„ ๊ทธ๋ฃนํ™”
575
- with gr.Row(visible=False) as buttons_row:
576
- # ํ”„๋กฌํ”„ํŠธ ์ƒ์„ฑ ๋ฒ„ํŠผ ์ถ”๊ฐ€
577
- prompt_generate_btn = gr.Button("ํ”„๋กฌํ”„ํŠธ ์ƒ์„ฑ", variant="secondary")
578
- # ์ด๋ฏธ์ง€ ์ƒ์„ฑ ๋ฒ„ํŠผ
579
- submit_btn = gr.Button("์ด๋ฏธ์ง€ ์ƒ์„ฑ", variant="primary")
580
 
581
  with gr.Column(scale=1):
582
  output_image = gr.Image(label="์ƒ์„ฑ๋œ ์ด๋ฏธ์ง€")
@@ -591,14 +590,14 @@ with gr.Blocks() as demo:
591
  gr.update(visible=True), gr.update(visible=True), gr.update(visible=True),
592
  gr.update(visible=True), gr.update(visible=True), gr.update(visible=True),
593
  gr.update(visible=True), gr.update(visible=True), gr.update(visible=True),
594
- gr.update(visible=True), "", gr.update(visible=True)) # ๋ฒ„ํŠผ ๊ทธ๋ฃน ํ‘œ์‹œ ์ถ”๊ฐ€
595
 
596
  background_change_btn.click(
597
  fn=show_background_options,
598
  inputs=[],
599
  outputs=[prompt_input, current_selection, background_header, product_name, product_category,
600
  background_type, background_style, additional_header, lighting, texture,
601
- color_tone, mood, selection_preview, buttons_row]
602
  )
603
 
604
  # ๋‹ค๋ฅธ ๊ธฐ๋Šฅ ๋ฒ„ํŠผ๋“ค๋„ ๊ฐ„๋‹จํ•œ ๋ฐฉ์‹์œผ๋กœ ์ˆ˜์ •
@@ -607,14 +606,14 @@ with gr.Blocks() as demo:
607
  gr.update(visible=False), gr.update(visible=False), gr.update(visible=False),
608
  gr.update(visible=False), gr.update(visible=False), gr.update(visible=False),
609
  gr.update(visible=False), gr.update(visible=False), gr.update(visible=False),
610
- gr.update(visible=False), "", gr.update(visible=False)) # ๋ฒ„ํŠผ ๊ทธ๋ฃน ์ˆจ๊น€ ์ถ”๊ฐ€
611
 
612
  image_change_btn.click(
613
  fn=lambda: hide_background_options("#1 ์ด๋ฏธ์ง€์˜ [๋‹ค๋ฅธ ๋ชจ์Šต]์œผ๋กœ ๋ณ€๊ฒฝํ•˜๋ผ."),
614
  inputs=[],
615
  outputs=[prompt_input, current_selection, background_header, product_name, product_category,
616
  background_type, background_style, additional_header, lighting, texture,
617
- color_tone, mood, selection_preview, buttons_row]
618
  )
619
 
620
  text_remove_btn.click(
@@ -622,7 +621,7 @@ with gr.Blocks() as demo:
622
  inputs=[],
623
  outputs=[prompt_input, current_selection, background_header, product_name, product_category,
624
  background_type, background_style, additional_header, lighting, texture,
625
- color_tone, mood, selection_preview, buttons_row]
626
  )
627
 
628
  clothes_change_btn.click(
@@ -630,7 +629,7 @@ with gr.Blocks() as demo:
630
  inputs=[],
631
  outputs=[prompt_input, current_selection, background_header, product_name, product_category,
632
  background_type, background_style, additional_header, lighting, texture,
633
- color_tone, mood, selection_preview, buttons_row]
634
  )
635
 
636
  composite_product_btn.click(
@@ -638,7 +637,7 @@ with gr.Blocks() as demo:
638
  inputs=[],
639
  outputs=[prompt_input, current_selection, background_header, product_name, product_category,
640
  background_type, background_style, additional_header, lighting, texture,
641
- color_tone, mood, selection_preview, buttons_row]
642
  )
643
 
644
  # ์„ ํƒ ์˜ต์…˜ ๋ณ€๊ฒฝ ์‹œ ๋ฏธ๋ฆฌ๋ณด๊ธฐ์™€ LLM ํ”„๋กฌํ”„ํŠธ ์—…๋ฐ์ดํŠธ
@@ -746,7 +745,4 @@ with gr.Blocks() as demo:
746
 
747
  > **ํŒ**: ์„ ํƒ ๋‚ด์šฉ ๋ฏธ๋ฆฌ๋ณด๊ธฐ์—์„œ ์ƒ์„ฑ๋  ํ”„๋กฌํ”„ํŠธ๋ฅผ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
748
  """
749
- )
750
-
751
- if __name__ == "__main__":
752
- demo.launch(share=True)
 
460
  else:
461
  return gr.update(choices=["์„ ํƒํ•˜์„ธ์š”"], value="์„ ํƒํ•˜์„ธ์š”")
462
 
463
+ # ์ธํ„ฐํŽ˜์ด์Šค ๋ถ€๋ถ„ ์ˆ˜์ •
464
  with gr.Blocks() as demo:
465
  gr.HTML(
466
  """
 
487
  )
488
 
489
  with gr.Row():
490
+ image_change_btn = gr.Button("์ด๋ฏธ์ง€ ๋ณ€๊ฒฝ", variant="secondary")
491
+ text_remove_btn = gr.Button("๊ธ€์ž์ง€์šฐ๊ธฐ", variant="secondary")
492
+ clothes_change_btn = gr.Button("์˜ท๋ฐ”๊พธ๊ธฐ", variant="secondary")
493
+ background_change_btn = gr.Button("๋ฐฐ๊ฒฝ๋ฐ”๊พธ๊ธฐ", variant="secondary")
494
+ composite_product_btn = gr.Button("์ƒํ’ˆํ•ฉ์„ฑ", variant="secondary")
495
 
496
  # ๋ฐฐ๊ฒฝ ๋ณ€๊ฒฝ ๊ด€๋ จ ์„น์…˜ (๊ธฐ๋ณธ์ ์œผ๋กœ ์ˆจ๊น€ ์ƒํƒœ)
497
  with gr.Row(visible=False) as background_header:
 
571
  visible=False
572
  )
573
 
574
+ # ํ”„๋กฌํ”„ํŠธ ์ƒ์„ฑ ๋ฒ„ํŠผ (๋ฐฐ๊ฒฝ๋ฐ”๊พธ๊ธฐ ์„ ํƒ์‹œ์—๋งŒ ๋‚˜ํƒ€๋‚จ)
575
+ prompt_generate_btn = gr.Button("ํ”„๋กฌํ”„ํŠธ ์ƒ์„ฑ", variant="secondary", visible=False)
576
+
577
+ # ์ด๋ฏธ์ง€ ์ƒ์„ฑ ๋ฒ„ํŠผ (ํ•ญ์ƒ ํ‘œ์‹œ)
578
+ submit_btn = gr.Button("์ด๋ฏธ์ง€ ์ƒ์„ฑ", variant="primary")
 
579
 
580
  with gr.Column(scale=1):
581
  output_image = gr.Image(label="์ƒ์„ฑ๋œ ์ด๋ฏธ์ง€")
 
590
  gr.update(visible=True), gr.update(visible=True), gr.update(visible=True),
591
  gr.update(visible=True), gr.update(visible=True), gr.update(visible=True),
592
  gr.update(visible=True), gr.update(visible=True), gr.update(visible=True),
593
+ gr.update(visible=True), "", gr.update(visible=True)) # ํ”„๋กฌํ”„ํŠธ ์ƒ์„ฑ ๋ฒ„ํŠผ ํ‘œ์‹œ
594
 
595
  background_change_btn.click(
596
  fn=show_background_options,
597
  inputs=[],
598
  outputs=[prompt_input, current_selection, background_header, product_name, product_category,
599
  background_type, background_style, additional_header, lighting, texture,
600
+ color_tone, mood, selection_preview, prompt_generate_btn]
601
  )
602
 
603
  # ๋‹ค๋ฅธ ๊ธฐ๋Šฅ ๋ฒ„ํŠผ๋“ค๋„ ๊ฐ„๋‹จํ•œ ๋ฐฉ์‹์œผ๋กœ ์ˆ˜์ •
 
606
  gr.update(visible=False), gr.update(visible=False), gr.update(visible=False),
607
  gr.update(visible=False), gr.update(visible=False), gr.update(visible=False),
608
  gr.update(visible=False), gr.update(visible=False), gr.update(visible=False),
609
+ gr.update(visible=False), "", gr.update(visible=False)) # ํ”„๋กฌํ”„ํŠธ ์ƒ์„ฑ ๋ฒ„ํŠผ ์ˆจ๊น€
610
 
611
  image_change_btn.click(
612
  fn=lambda: hide_background_options("#1 ์ด๋ฏธ์ง€์˜ [๋‹ค๋ฅธ ๋ชจ์Šต]์œผ๋กœ ๋ณ€๊ฒฝํ•˜๋ผ."),
613
  inputs=[],
614
  outputs=[prompt_input, current_selection, background_header, product_name, product_category,
615
  background_type, background_style, additional_header, lighting, texture,
616
+ color_tone, mood, selection_preview, prompt_generate_btn]
617
  )
618
 
619
  text_remove_btn.click(
 
621
  inputs=[],
622
  outputs=[prompt_input, current_selection, background_header, product_name, product_category,
623
  background_type, background_style, additional_header, lighting, texture,
624
+ color_tone, mood, selection_preview, prompt_generate_btn]
625
  )
626
 
627
  clothes_change_btn.click(
 
629
  inputs=[],
630
  outputs=[prompt_input, current_selection, background_header, product_name, product_category,
631
  background_type, background_style, additional_header, lighting, texture,
632
+ color_tone, mood, selection_preview, prompt_generate_btn]
633
  )
634
 
635
  composite_product_btn.click(
 
637
  inputs=[],
638
  outputs=[prompt_input, current_selection, background_header, product_name, product_category,
639
  background_type, background_style, additional_header, lighting, texture,
640
+ color_tone, mood, selection_preview, prompt_generate_btn]
641
  )
642
 
643
  # ์„ ํƒ ์˜ต์…˜ ๋ณ€๊ฒฝ ์‹œ ๋ฏธ๋ฆฌ๋ณด๊ธฐ์™€ LLM ํ”„๋กฌํ”„ํŠธ ์—…๋ฐ์ดํŠธ
 
745
 
746
  > **ํŒ**: ์„ ํƒ ๋‚ด์šฉ ๋ฏธ๋ฆฌ๋ณด๊ธฐ์—์„œ ์ƒ์„ฑ๋  ํ”„๋กฌํ”„ํŠธ๋ฅผ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
747
  """
748
+ )