Update app.py
Browse files
app.py
CHANGED
|
@@ -15,7 +15,7 @@ logger = logging.getLogger(__name__)
|
|
| 15 |
# ์ด๋ฏธ์ง ์บ์
|
| 16 |
IMAGE_CACHE = {}
|
| 17 |
|
| 18 |
-
# CSS (์๋ณธ ์คํ์ผ ์ ์ง + ์์ ํฌ๊ธฐ ์ถ์
|
| 19 |
custom_css = """
|
| 20 |
:root {
|
| 21 |
--primary-color: #FB7F0D;
|
|
@@ -96,20 +96,25 @@ body {
|
|
| 96 |
}
|
| 97 |
footer { visibility: hidden; }
|
| 98 |
.gradio-container {
|
| 99 |
-
padding-bottom:
|
| 100 |
-
margin-bottom:
|
| 101 |
}
|
| 102 |
-
.gr-block {
|
| 103 |
-
margin
|
|
|
|
|
|
|
|
|
|
|
|
|
| 104 |
}
|
| 105 |
"""
|
| 106 |
|
| 107 |
-
#
|
| 108 |
fontawesome_link = """
|
| 109 |
-
<link rel
|
| 110 |
"""
|
| 111 |
|
| 112 |
# ์ด๋ฏธ์ง ๋ก๋ ๋ฐ ์บ์
|
|
|
|
| 113 |
def load_image_cached(path):
|
| 114 |
if path not in IMAGE_CACHE:
|
| 115 |
try:
|
|
@@ -126,17 +131,20 @@ def load_image_cached(path):
|
|
| 126 |
return IMAGE_CACHE[path]
|
| 127 |
|
| 128 |
# ์์ ๋ฏธ๋ฆฌ ๋ก๋
|
|
|
|
| 129 |
def preload_example_images():
|
| 130 |
for ex in product_background_examples:
|
| 131 |
load_image_cached(ex[0])
|
| 132 |
load_image_cached(ex[5])
|
| 133 |
|
| 134 |
# ์์ ์ ํ ํธ๋ค๋ฌ
|
|
|
|
| 135 |
def load_example(evt: gr.SelectData):
|
| 136 |
ex = product_background_examples[evt.index]
|
| 137 |
return ex[0], ex[1], ex[2], ex[3], ex[4] or "(์์)", ex[5]
|
| 138 |
|
| 139 |
# ์ฒซ ๋ฒ์งธ ์์ ์๋ ๋ก๋
|
|
|
|
| 140 |
def load_first_example():
|
| 141 |
if product_background_examples:
|
| 142 |
ex = product_background_examples[0]
|
|
@@ -144,6 +152,7 @@ def load_first_example():
|
|
| 144 |
return None, "", "", "", "", None
|
| 145 |
|
| 146 |
# Gradio ์ฑ ์์ฑ
|
|
|
|
| 147 |
def create_app():
|
| 148 |
with gr.Blocks(css=custom_css, theme=gr.themes.Default(
|
| 149 |
primary_hue="orange", secondary_hue="orange",
|
|
|
|
| 15 |
# ์ด๋ฏธ์ง ์บ์
|
| 16 |
IMAGE_CACHE = {}
|
| 17 |
|
| 18 |
+
# CSS (์๋ณธ ์คํ์ผ ์ ์ง + ์์ ํฌ๊ธฐ ์ถ์)
|
| 19 |
custom_css = """
|
| 20 |
:root {
|
| 21 |
--primary-color: #FB7F0D;
|
|
|
|
| 96 |
}
|
| 97 |
footer { visibility: hidden; }
|
| 98 |
.gradio-container {
|
| 99 |
+
padding-bottom: 0 !important;
|
| 100 |
+
margin-bottom: 0 !important;
|
| 101 |
}
|
| 102 |
+
.gr-block, .gr-row, .gr-column {
|
| 103 |
+
margin: 0 !important;
|
| 104 |
+
padding: 0 !important;
|
| 105 |
+
}
|
| 106 |
+
html, body, .gradio-container, .gr-block, .gr-row, .gr-column {
|
| 107 |
+
height: auto !important;
|
| 108 |
}
|
| 109 |
"""
|
| 110 |
|
| 111 |
+
# ์์ด์ฝ ๋งํฌ
|
| 112 |
fontawesome_link = """
|
| 113 |
+
<link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css\" crossorigin=\"anonymous\" referrerpolicy=\"no-referrer\" />
|
| 114 |
"""
|
| 115 |
|
| 116 |
# ์ด๋ฏธ์ง ๋ก๋ ๋ฐ ์บ์
|
| 117 |
+
|
| 118 |
def load_image_cached(path):
|
| 119 |
if path not in IMAGE_CACHE:
|
| 120 |
try:
|
|
|
|
| 131 |
return IMAGE_CACHE[path]
|
| 132 |
|
| 133 |
# ์์ ๋ฏธ๋ฆฌ ๋ก๋
|
| 134 |
+
|
| 135 |
def preload_example_images():
|
| 136 |
for ex in product_background_examples:
|
| 137 |
load_image_cached(ex[0])
|
| 138 |
load_image_cached(ex[5])
|
| 139 |
|
| 140 |
# ์์ ์ ํ ํธ๋ค๋ฌ
|
| 141 |
+
|
| 142 |
def load_example(evt: gr.SelectData):
|
| 143 |
ex = product_background_examples[evt.index]
|
| 144 |
return ex[0], ex[1], ex[2], ex[3], ex[4] or "(์์)", ex[5]
|
| 145 |
|
| 146 |
# ์ฒซ ๋ฒ์งธ ์์ ์๋ ๋ก๋
|
| 147 |
+
|
| 148 |
def load_first_example():
|
| 149 |
if product_background_examples:
|
| 150 |
ex = product_background_examples[0]
|
|
|
|
| 152 |
return None, "", "", "", "", None
|
| 153 |
|
| 154 |
# Gradio ์ฑ ์์ฑ
|
| 155 |
+
|
| 156 |
def create_app():
|
| 157 |
with gr.Blocks(css=custom_css, theme=gr.themes.Default(
|
| 158 |
primary_hue="orange", secondary_hue="orange",
|