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;
|
|
@@ -95,15 +95,21 @@ body {
|
|
| 95 |
padding: 0;
|
| 96 |
}
|
| 97 |
footer { visibility: hidden; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 98 |
"""
|
| 99 |
|
| 100 |
-
# ์์ด์ฝ ๋งํฌ
|
| 101 |
fontawesome_link = """
|
| 102 |
-
<link rel
|
| 103 |
"""
|
| 104 |
|
| 105 |
# ์ด๋ฏธ์ง ๋ก๋ ๋ฐ ์บ์
|
| 106 |
-
|
| 107 |
def load_image_cached(path):
|
| 108 |
if path not in IMAGE_CACHE:
|
| 109 |
try:
|
|
@@ -120,20 +126,17 @@ def load_image_cached(path):
|
|
| 120 |
return IMAGE_CACHE[path]
|
| 121 |
|
| 122 |
# ์์ ๋ฏธ๋ฆฌ ๋ก๋
|
| 123 |
-
|
| 124 |
def preload_example_images():
|
| 125 |
for ex in product_background_examples:
|
| 126 |
load_image_cached(ex[0])
|
| 127 |
load_image_cached(ex[5])
|
| 128 |
|
| 129 |
# ์์ ์ ํ ํธ๋ค๋ฌ
|
| 130 |
-
|
| 131 |
def load_example(evt: gr.SelectData):
|
| 132 |
ex = product_background_examples[evt.index]
|
| 133 |
return ex[0], ex[1], ex[2], ex[3], ex[4] or "(์์)", ex[5]
|
| 134 |
|
| 135 |
# ์ฒซ ๋ฒ์งธ ์์ ์๋ ๋ก๋
|
| 136 |
-
|
| 137 |
def load_first_example():
|
| 138 |
if product_background_examples:
|
| 139 |
ex = product_background_examples[0]
|
|
@@ -141,7 +144,6 @@ def load_first_example():
|
|
| 141 |
return None, "", "", "", "", None
|
| 142 |
|
| 143 |
# Gradio ์ฑ ์์ฑ
|
| 144 |
-
|
| 145 |
def create_app():
|
| 146 |
with gr.Blocks(css=custom_css, theme=gr.themes.Default(
|
| 147 |
primary_hue="orange", secondary_hue="orange",
|
|
|
|
| 15 |
# ์ด๋ฏธ์ง ์บ์
|
| 16 |
IMAGE_CACHE = {}
|
| 17 |
|
| 18 |
+
# CSS (์๋ณธ ์คํ์ผ ์ ์ง + ์์ ํฌ๊ธฐ ์ถ์ + ํ๋จ ์ฌ๋ฐฑ ์ ๊ฑฐ)
|
| 19 |
custom_css = """
|
| 20 |
:root {
|
| 21 |
--primary-color: #FB7F0D;
|
|
|
|
| 95 |
padding: 0;
|
| 96 |
}
|
| 97 |
footer { visibility: hidden; }
|
| 98 |
+
.gradio-container {
|
| 99 |
+
padding-bottom: 0px !important;
|
| 100 |
+
margin-bottom: 0px !important;
|
| 101 |
+
}
|
| 102 |
+
.gr-block {
|
| 103 |
+
margin-bottom: 0px !important;
|
| 104 |
+
}
|
| 105 |
"""
|
| 106 |
|
| 107 |
+
# FontAwesome ์์ด์ฝ ๋งํฌ
|
| 108 |
fontawesome_link = """
|
| 109 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" crossorigin="anonymous" referrerpolicy="no-referrer" />
|
| 110 |
"""
|
| 111 |
|
| 112 |
# ์ด๋ฏธ์ง ๋ก๋ ๋ฐ ์บ์
|
|
|
|
| 113 |
def load_image_cached(path):
|
| 114 |
if path not in IMAGE_CACHE:
|
| 115 |
try:
|
|
|
|
| 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 |
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",
|