Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -735,8 +735,6 @@ def update_controls(bg_prompt):
|
|
735 |
]
|
736 |
|
737 |
with gr.Blocks(theme=gr.themes.Soft(), css=css) as demo:
|
738 |
-
position = gr.State(value="bottom-center") # 여기로 이동
|
739 |
-
|
740 |
gr.HTML("""
|
741 |
<div class="main-title">
|
742 |
<h1>🎨 GiniGen Canvas-o3</h1>
|
@@ -777,7 +775,7 @@ with gr.Blocks(theme=gr.themes.Soft(), css=css) as demo:
|
|
777 |
|
778 |
with gr.Group(elem_classes="controls-panel", visible=False) as object_controls:
|
779 |
with gr.Column(scale=1):
|
780 |
-
position = gr.State(value="bottom-center")
|
781 |
with gr.Row():
|
782 |
btn_top_left = gr.Button("↖", elem_classes="position-btn")
|
783 |
btn_top_center = gr.Button("↑", elem_classes="position-btn")
|
@@ -817,7 +815,6 @@ with gr.Blocks(theme=gr.themes.Soft(), css=css) as demo:
|
|
817 |
height=400
|
818 |
)
|
819 |
|
820 |
-
# 텍스트 삽입 옵션을 Accordion으로 변경
|
821 |
with gr.Accordion("Text Insertion Options", open=False):
|
822 |
with gr.Group():
|
823 |
with gr.Row():
|
@@ -889,17 +886,7 @@ with gr.Blocks(theme=gr.themes.Soft(), css=css) as demo:
|
|
889 |
height=200
|
890 |
)
|
891 |
|
892 |
-
#
|
893 |
-
gr.HTML("""
|
894 |
-
<style>
|
895 |
-
.position-btn.selected {
|
896 |
-
background-color: #2196F3 !important;
|
897 |
-
color: white !important;
|
898 |
-
}
|
899 |
-
</style>
|
900 |
-
""")
|
901 |
-
|
902 |
-
# 버튼 클릭 이벤트 바인딩
|
903 |
position_mapping = {
|
904 |
btn_top_left: "top-left",
|
905 |
btn_top_center: "top-center",
|
@@ -914,20 +901,10 @@ with gr.Blocks(theme=gr.themes.Soft(), css=css) as demo:
|
|
914 |
|
915 |
for btn, pos in position_mapping.items():
|
916 |
btn.click(
|
917 |
-
fn=lambda pos=pos: update_position(pos),
|
918 |
outputs=position
|
919 |
)
|
920 |
|
921 |
-
|
922 |
-
# 추가: 결과 이미지 업데이트를 위한 이벤트
|
923 |
-
combined_image.change(
|
924 |
-
fn=lambda x: x,
|
925 |
-
inputs=combined_image,
|
926 |
-
outputs=combined_image,
|
927 |
-
queue=False
|
928 |
-
)
|
929 |
-
|
930 |
-
|
931 |
bg_prompt.change(
|
932 |
fn=update_controls,
|
933 |
inputs=bg_prompt,
|
@@ -949,11 +926,6 @@ with gr.Blocks(theme=gr.themes.Soft(), css=css) as demo:
|
|
949 |
queue=False
|
950 |
)
|
951 |
|
952 |
-
|
953 |
-
|
954 |
-
|
955 |
-
|
956 |
-
# 이벤트 바인딩
|
957 |
process_btn.click(
|
958 |
fn=process_prompt,
|
959 |
inputs=[
|
@@ -965,8 +937,7 @@ with gr.Blocks(theme=gr.themes.Soft(), css=css) as demo:
|
|
965 |
scale_slider
|
966 |
],
|
967 |
outputs=[combined_image, extracted_image],
|
968 |
-
queue=True
|
969 |
-
show_progress=True
|
970 |
)
|
971 |
|
972 |
add_text_btn.click(
|
@@ -984,17 +955,14 @@ with gr.Blocks(theme=gr.themes.Soft(), css=css) as demo:
|
|
984 |
font_choice
|
985 |
],
|
986 |
outputs=combined_image,
|
987 |
-
queue=True
|
988 |
-
show_progress=True
|
989 |
)
|
990 |
|
991 |
-
#
|
992 |
-
demo.queue(
|
993 |
demo.launch(
|
994 |
server_name="0.0.0.0",
|
995 |
server_port=7860,
|
996 |
-
share=False
|
997 |
-
|
998 |
-
|
999 |
-
prevent_thread_lock=True
|
1000 |
-
)
|
|
|
735 |
]
|
736 |
|
737 |
with gr.Blocks(theme=gr.themes.Soft(), css=css) as demo:
|
|
|
|
|
738 |
gr.HTML("""
|
739 |
<div class="main-title">
|
740 |
<h1>🎨 GiniGen Canvas-o3</h1>
|
|
|
775 |
|
776 |
with gr.Group(elem_classes="controls-panel", visible=False) as object_controls:
|
777 |
with gr.Column(scale=1):
|
778 |
+
position = gr.State(value="bottom-center")
|
779 |
with gr.Row():
|
780 |
btn_top_left = gr.Button("↖", elem_classes="position-btn")
|
781 |
btn_top_center = gr.Button("↑", elem_classes="position-btn")
|
|
|
815 |
height=400
|
816 |
)
|
817 |
|
|
|
818 |
with gr.Accordion("Text Insertion Options", open=False):
|
819 |
with gr.Group():
|
820 |
with gr.Row():
|
|
|
886 |
height=200
|
887 |
)
|
888 |
|
889 |
+
# 이벤트 바인딩
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
890 |
position_mapping = {
|
891 |
btn_top_left: "top-left",
|
892 |
btn_top_center: "top-center",
|
|
|
901 |
|
902 |
for btn, pos in position_mapping.items():
|
903 |
btn.click(
|
904 |
+
fn=lambda pos=pos: update_position(pos),
|
905 |
outputs=position
|
906 |
)
|
907 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
908 |
bg_prompt.change(
|
909 |
fn=update_controls,
|
910 |
inputs=bg_prompt,
|
|
|
926 |
queue=False
|
927 |
)
|
928 |
|
|
|
|
|
|
|
|
|
|
|
929 |
process_btn.click(
|
930 |
fn=process_prompt,
|
931 |
inputs=[
|
|
|
937 |
scale_slider
|
938 |
],
|
939 |
outputs=[combined_image, extracted_image],
|
940 |
+
queue=True
|
|
|
941 |
)
|
942 |
|
943 |
add_text_btn.click(
|
|
|
955 |
font_choice
|
956 |
],
|
957 |
outputs=combined_image,
|
958 |
+
queue=True
|
|
|
959 |
)
|
960 |
|
961 |
+
# 간단한 큐 설정으로 변경
|
962 |
+
demo.queue()
|
963 |
demo.launch(
|
964 |
server_name="0.0.0.0",
|
965 |
server_port=7860,
|
966 |
+
share=False
|
967 |
+
)
|
968 |
+
|
|
|
|