ginipick commited on
Commit
efb2200
ยท
verified ยท
1 Parent(s): 8a2208e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -8
app.py CHANGED
@@ -681,9 +681,13 @@ current_position = None # position ์ƒํƒœ๋ฅผ ์ „์—ญ์œผ๋กœ ๊ด€๋ฆฌํ•˜๊ธฐ ์œ„ํ•œ
681
  # ์œ„์น˜ ์—…๋ฐ์ดํŠธ ํ•จ์ˆ˜ ์ˆ˜์ •
682
  def update_position(new_position):
683
  print(f"Position updated to: {new_position}") # ๋””๋ฒ„๊น…์šฉ
 
 
 
 
 
684
  return new_position
685
-
686
-
687
  def update_button_styles():
688
  return {
689
  btn: gr.update(elem_classes=["position-btn", "selected"] if pos == current_position else ["position-btn"])
@@ -878,6 +882,22 @@ with gr.Blocks(theme=gr.themes.Soft(), css=css) as demo:
878
  btn_bottom_center.click(fn=lambda: update_position("bottom-center"), outputs=position)
879
  btn_bottom_right.click(fn=lambda: update_position("bottom-right"), outputs=position)
880
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
881
  # ๊ธฐํƒ€ ์ด๋ฒคํŠธ ๋ฐ”์ธ๋”ฉ
882
  input_image.change(
883
  fn=update_process_button,
@@ -893,12 +913,7 @@ with gr.Blocks(theme=gr.themes.Soft(), css=css) as demo:
893
  queue=False
894
  )
895
 
896
- bg_prompt.change(
897
- fn=update_controls,
898
- inputs=bg_prompt,
899
- outputs=[aspect_ratio, object_controls],
900
- queue=False
901
- )
902
 
903
  process_btn.click(
904
  fn=process_prompt,
 
681
  # ์œ„์น˜ ์—…๋ฐ์ดํŠธ ํ•จ์ˆ˜ ์ˆ˜์ •
682
  def update_position(new_position):
683
  print(f"Position updated to: {new_position}") # ๋””๋ฒ„๊น…์šฉ
684
+ # ๋ชจ๋“  ๋ฒ„ํŠผ์˜ ์Šคํƒ€์ผ ์—…๋ฐ์ดํŠธ
685
+ for btn in [btn_top_left, btn_top_center, btn_top_right,
686
+ btn_middle_left, btn_middle_center, btn_middle_right,
687
+ btn_bottom_left, btn_bottom_center, btn_bottom_right]:
688
+ btn.elem_classes = ["position-btn", "selected"] if btn == new_position else ["position-btn"]
689
  return new_position
690
+
 
691
  def update_button_styles():
692
  return {
693
  btn: gr.update(elem_classes=["position-btn", "selected"] if pos == current_position else ["position-btn"])
 
882
  btn_bottom_center.click(fn=lambda: update_position("bottom-center"), outputs=position)
883
  btn_bottom_right.click(fn=lambda: update_position("bottom-right"), outputs=position)
884
 
885
+ def update_controls(bg_prompt):
886
+ """๋ฐฐ๊ฒฝ ํ”„๋กฌํ”„ํŠธ ์ž…๋ ฅ ์—ฌ๋ถ€์— ๋”ฐ๋ผ ์ปจํŠธ๋กค ํ‘œ์‹œ ์—…๋ฐ์ดํŠธ"""
887
+ is_visible = bool(bg_prompt)
888
+ return [
889
+ gr.update(visible=is_visible), # aspect_ratio
890
+ gr.update(visible=is_visible), # object_controls
891
+ ]
892
+
893
+ # ์ด๋ฒคํŠธ ๋ฐ”์ธ๋”ฉ์—์„œ๋„ ํ•„์š”
894
+ bg_prompt.change(
895
+ fn=update_controls,
896
+ inputs=bg_prompt,
897
+ outputs=[aspect_ratio, object_controls],
898
+ queue=False
899
+ )
900
+
901
  # ๊ธฐํƒ€ ์ด๋ฒคํŠธ ๋ฐ”์ธ๋”ฉ
902
  input_image.change(
903
  fn=update_process_button,
 
913
  queue=False
914
  )
915
 
916
+
 
 
 
 
 
917
 
918
  process_btn.click(
919
  fn=process_prompt,