Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -467,17 +467,22 @@ with gr.Blocks(theme=gr.themes.Soft(), css=css) as demo:
|
|
| 467 |
scale=1
|
| 468 |
)
|
| 469 |
|
| 470 |
-
|
| 471 |
with gr.Row(visible=False) as object_controls:
|
| 472 |
with gr.Column(scale=1):
|
| 473 |
-
|
| 474 |
-
|
| 475 |
-
|
| 476 |
-
|
| 477 |
-
|
| 478 |
-
|
| 479 |
-
|
| 480 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 481 |
with gr.Column(scale=1):
|
| 482 |
scale_slider = gr.Slider(
|
| 483 |
minimum=10,
|
|
@@ -487,6 +492,21 @@ with gr.Blocks(theme=gr.themes.Soft(), css=css) as demo:
|
|
| 487 |
label="Object Size (%)"
|
| 488 |
)
|
| 489 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 490 |
|
| 491 |
# 위치 선택 이벤트 처리
|
| 492 |
position_grid.click(
|
|
|
|
| 467 |
scale=1
|
| 468 |
)
|
| 469 |
|
| 470 |
+
|
| 471 |
with gr.Row(visible=False) as object_controls:
|
| 472 |
with gr.Column(scale=1):
|
| 473 |
+
with gr.Row():
|
| 474 |
+
position = gr.State(value="bottom-center")
|
| 475 |
+
btn_top_left = gr.Button("↖")
|
| 476 |
+
btn_top_center = gr.Button("↑")
|
| 477 |
+
btn_top_right = gr.Button("↗")
|
| 478 |
+
with gr.Row():
|
| 479 |
+
btn_middle_left = gr.Button("←")
|
| 480 |
+
btn_middle_center = gr.Button("•")
|
| 481 |
+
btn_middle_right = gr.Button("→")
|
| 482 |
+
with gr.Row():
|
| 483 |
+
btn_bottom_left = gr.Button("↙")
|
| 484 |
+
btn_bottom_center = gr.Button("↓")
|
| 485 |
+
btn_bottom_right = gr.Button("↘")
|
| 486 |
with gr.Column(scale=1):
|
| 487 |
scale_slider = gr.Slider(
|
| 488 |
minimum=10,
|
|
|
|
| 492 |
label="Object Size (%)"
|
| 493 |
)
|
| 494 |
|
| 495 |
+
# 각 버튼에 대한 클릭 이벤트 처리
|
| 496 |
+
def update_position(new_position):
|
| 497 |
+
return new_position
|
| 498 |
+
|
| 499 |
+
btn_top_left.click(fn=lambda: update_position("top-left"), outputs=position)
|
| 500 |
+
btn_top_center.click(fn=lambda: update_position("top-center"), outputs=position)
|
| 501 |
+
btn_top_right.click(fn=lambda: update_position("top-right"), outputs=position)
|
| 502 |
+
btn_middle_left.click(fn=lambda: update_position("middle-left"), outputs=position)
|
| 503 |
+
btn_middle_center.click(fn=lambda: update_position("middle-center"), outputs=position)
|
| 504 |
+
btn_middle_right.click(fn=lambda: update_position("middle-right"), outputs=position)
|
| 505 |
+
btn_bottom_left.click(fn=lambda: update_position("bottom-left"), outputs=position)
|
| 506 |
+
btn_bottom_center.click(fn=lambda: update_position("bottom-center"), outputs=position)
|
| 507 |
+
btn_bottom_right.click(fn=lambda: update_position("bottom-right"), outputs=position)
|
| 508 |
+
|
| 509 |
+
|
| 510 |
|
| 511 |
# 위치 선택 이벤트 처리
|
| 512 |
position_grid.click(
|