Spaces:
Paused
Paused
Update app.py
Browse files
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 |
-
|
| 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,
|