Update app.py
Browse files
app.py
CHANGED
@@ -575,18 +575,16 @@ def safe_state_update(state, updates):
|
|
575 |
return state
|
576 |
|
577 |
def create_interface():
|
578 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
579 |
|
580 |
-
initial_state = {
|
581 |
-
"user_name": "",
|
582 |
-
"baseline_features": None,
|
583 |
-
"reflections": [],
|
584 |
-
"wish": None,
|
585 |
-
"final_prompt": "",
|
586 |
-
"image_path": None,
|
587 |
-
"current_tab": 0
|
588 |
-
}
|
589 |
-
|
590 |
css = """
|
591 |
/* 모바일 뷰 */
|
592 |
@media (max-width: 600px) {
|
@@ -594,19 +592,14 @@ def create_interface():
|
|
594 |
padding: 20px 10px !important;
|
595 |
width: 100% !important;
|
596 |
}
|
597 |
-
|
|
|
598 |
width: 100% !important;
|
599 |
height: auto !important;
|
600 |
max-width: 300px !important;
|
601 |
margin: 0 auto !important;
|
602 |
display: block !important;
|
603 |
}
|
604 |
-
.container { padding: 10px !important; }
|
605 |
-
.gradio-button {
|
606 |
-
width: 100% !important;
|
607 |
-
margin: 5px 0 !important;
|
608 |
-
min-height: 44px !important;
|
609 |
-
}
|
610 |
}
|
611 |
|
612 |
/* 데스크톱 뷰 */
|
@@ -617,7 +610,8 @@ def create_interface():
|
|
617 |
max-width: 800px;
|
618 |
margin: 0 auto;
|
619 |
}
|
620 |
-
|
|
|
621 |
width: 100%;
|
622 |
height: auto;
|
623 |
max-width: 800px;
|
@@ -637,11 +631,10 @@ def create_interface():
|
|
637 |
with gr.Blocks(theme=gr.themes.Soft(), css=css) as app:
|
638 |
state = gr.State(value=initial_state)
|
639 |
|
640 |
-
# 로고 컨테이너 수정
|
641 |
with gr.Column(elem_classes="logo-container"):
|
642 |
-
|
643 |
-
|
644 |
-
<img
|
645 |
""")
|
646 |
|
647 |
gr.Markdown("""
|
|
|
575 |
return state
|
576 |
|
577 |
def create_interface():
|
578 |
+
import base64
|
579 |
+
|
580 |
+
def get_image_base64(image_path):
|
581 |
+
with open(image_path, "rb") as img_file:
|
582 |
+
return base64.b64encode(img_file.read()).decode()
|
583 |
+
|
584 |
+
# 모바일/데스크톱 로고 미리 인코딩
|
585 |
+
mobile_logo = get_image_base64("static/DIGITAL_GUTPAN_LOGO_m.png")
|
586 |
+
desktop_logo = get_image_base64("static/DIGITAL_GUTPAN_LOGO_w.png")
|
587 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
588 |
css = """
|
589 |
/* 모바일 뷰 */
|
590 |
@media (max-width: 600px) {
|
|
|
592 |
padding: 20px 10px !important;
|
593 |
width: 100% !important;
|
594 |
}
|
595 |
+
.desktop-logo { display: none !important; }
|
596 |
+
.mobile-logo {
|
597 |
width: 100% !important;
|
598 |
height: auto !important;
|
599 |
max-width: 300px !important;
|
600 |
margin: 0 auto !important;
|
601 |
display: block !important;
|
602 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
603 |
}
|
604 |
|
605 |
/* 데스크톱 뷰 */
|
|
|
610 |
max-width: 800px;
|
611 |
margin: 0 auto;
|
612 |
}
|
613 |
+
.mobile-logo { display: none !important; }
|
614 |
+
.desktop-logo {
|
615 |
width: 100%;
|
616 |
height: auto;
|
617 |
max-width: 800px;
|
|
|
631 |
with gr.Blocks(theme=gr.themes.Soft(), css=css) as app:
|
632 |
state = gr.State(value=initial_state)
|
633 |
|
|
|
634 |
with gr.Column(elem_classes="logo-container"):
|
635 |
+
gr.HTML(f"""
|
636 |
+
<img class="mobile-logo" src="data:image/png;base64,{mobile_logo}" alt="디지털 굿판 로고 모바일">
|
637 |
+
<img class="desktop-logo" src="data:image/png;base64,{desktop_logo}" alt="디지털 굿판 로고 데스크톱">
|
638 |
""")
|
639 |
|
640 |
gr.Markdown("""
|