Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -844,23 +844,37 @@ with gr.Blocks(theme=gr.themes.Soft(), css=css) as demo:
|
|
| 844 |
</style>
|
| 845 |
""")
|
| 846 |
|
| 847 |
-
|
| 848 |
-
|
| 849 |
-
|
| 850 |
-
|
| 851 |
-
|
| 852 |
-
|
| 853 |
-
|
| 854 |
-
|
| 855 |
-
|
| 856 |
-
|
| 857 |
-
|
| 858 |
-
|
| 859 |
-
|
| 860 |
-
|
| 861 |
-
|
| 862 |
-
|
| 863 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 864 |
|
| 865 |
# 기존 이벤트 바인딩
|
| 866 |
input_image.change(
|
|
|
|
| 844 |
</style>
|
| 845 |
""")
|
| 846 |
|
| 847 |
+
# 위치 업데이트 함수 수정
|
| 848 |
+
def update_position(new_position):
|
| 849 |
+
print(f"Position updated to: {new_position}") # 디버깅용
|
| 850 |
+
return new_position
|
| 851 |
+
|
| 852 |
+
# 버튼 클릭 이벤트 바인딩 수정
|
| 853 |
+
btn_top_left.click(fn=lambda: update_position("top-left"), outputs=position)
|
| 854 |
+
btn_top_center.click(fn=lambda: update_position("top-center"), outputs=position)
|
| 855 |
+
btn_top_right.click(fn=lambda: update_position("top-right"), outputs=position)
|
| 856 |
+
btn_middle_left.click(fn=lambda: update_position("middle-left"), outputs=position)
|
| 857 |
+
btn_middle_center.click(fn=lambda: update_position("middle-center"), outputs=position)
|
| 858 |
+
btn_middle_right.click(fn=lambda: update_position("middle-right"), outputs=position)
|
| 859 |
+
btn_bottom_left.click(fn=lambda: update_position("bottom-left"), outputs=position)
|
| 860 |
+
btn_bottom_center.click(fn=lambda: update_position("bottom-center"), outputs=position)
|
| 861 |
+
btn_bottom_right.click(fn=lambda: update_position("bottom-right"), outputs=position)
|
| 862 |
+
|
| 863 |
+
def update_button_styles():
|
| 864 |
+
return {
|
| 865 |
+
btn: gr.update(elem_classes=["position-btn", "selected"] if pos == current_position else ["position-btn"])
|
| 866 |
+
for btn, pos in [
|
| 867 |
+
(btn_top_left, "top-left"),
|
| 868 |
+
(btn_top_center, "top-center"),
|
| 869 |
+
(btn_top_right, "top-right"),
|
| 870 |
+
(btn_middle_left, "middle-left"),
|
| 871 |
+
(btn_middle_center, "middle-center"),
|
| 872 |
+
(btn_middle_right, "middle-right"),
|
| 873 |
+
(btn_bottom_left, "bottom-left"),
|
| 874 |
+
(btn_bottom_center, "bottom-center"),
|
| 875 |
+
(btn_bottom_right, "bottom-right")
|
| 876 |
+
]
|
| 877 |
+
}
|
| 878 |
|
| 879 |
# 기존 이벤트 바인딩
|
| 880 |
input_image.change(
|