Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -188,60 +188,53 @@ st.markdown(
|
|
| 188 |
)
|
| 189 |
|
| 190 |
# κ³ μ μ΄λ―Έμ§ URL
|
| 191 |
-
BG_URL = "https://plus.unsplash.com/premium_photo-1679830513869-cd3648acb1db?q=80&w=2127&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D"
|
| 192 |
|
| 193 |
-
|
| 194 |
-
st.sidebar.
|
| 195 |
-
st.sidebar.toggle("λ°°κ²½ μ΄λ―Έμ§ μ¬μ©", key="bg_on", value=True)
|
| 196 |
|
| 197 |
def apply_background():
|
| 198 |
-
|
| 199 |
-
base_reset_css = """
|
| 200 |
<style>
|
| 201 |
-
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
|
| 205 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 206 |
</style>
|
| 207 |
-
"""
|
| 208 |
-
st.markdown(base_reset_css, unsafe_allow_html=True)
|
| 209 |
-
|
| 210 |
-
if st.session_state.get("bg_on") and st.session_state.get("bg_url"):
|
| 211 |
-
url = st.session_state["bg_url"]
|
| 212 |
-
# 0~1 λ‘ λ³ν (ν° μ€λ²λ μ΄λ‘ λ°κΈ°/κ°λ
μ± μ‘°μ )
|
| 213 |
-
overlay_alpha = float(st.session_state.get("bg_overlay_pct", 15)) / 100.0
|
| 214 |
-
|
| 215 |
-
# β
μ΄λ―Έμ§ λ°°κ²½ (λκΉ λ°©μ§: νμ΄μ§ μ 체 .stAppμ κ³ μ λ°°κ²½)
|
| 216 |
-
st.markdown(f"""
|
| 217 |
-
<style>
|
| 218 |
-
.stApp{{
|
| 219 |
-
background: url('{url}') center / cover no-repeat fixed;
|
| 220 |
-
}}
|
| 221 |
-
/* μ€λ²λ μ΄: μ΄λ―Έμ§ μμ ν°μ λ§μ μΉμ΄ κ°λ
μ± ν보 (ν¬λͺ
λ μ‘°μ κ°λ₯) */
|
| 222 |
-
.stApp::after{{
|
| 223 |
-
content:""; position:fixed; inset:0; z-index:0; pointer-events:none;
|
| 224 |
-
background: rgba(255,255,255,{overlay_alpha});
|
| 225 |
-
}}
|
| 226 |
-
/* λͺ¨λ°μΌμ fixed μ΄μκ° μμ΄ κ³ μ ν΄μ */
|
| 227 |
-
@media (max-width:768px){{
|
| 228 |
-
.stApp{{ background-attachment: initial; }}
|
| 229 |
-
}}
|
| 230 |
-
</style>
|
| 231 |
-
""", unsafe_allow_html=True)
|
| 232 |
|
| 233 |
-
else:
|
| 234 |
-
# β
λ¨μ λ°°κ²½ (λκΉ μμ: μμ μ체μ background-color μ¬μ©)
|
| 235 |
-
color = st.session_state.get("bg_color", "#F1F1F1")
|
| 236 |
-
st.markdown(f"""
|
| 237 |
-
<style>
|
| 238 |
-
.stApp{{ background-color: {color} !important; }}
|
| 239 |
-
</style>
|
| 240 |
-
""", unsafe_allow_html=True)
|
| 241 |
-
|
| 242 |
-
# νΈμΆ
|
| 243 |
apply_background()
|
| 244 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 245 |
# βββββββββββββββββββββββββββββββββββββ region mode
|
| 246 |
def region_ui(travel_df, external_score_df, festival_df, weather_df, package_df,
|
| 247 |
country_filter, city_filter, chat_container, log_and_render):
|
|
|
|
| 188 |
)
|
| 189 |
|
| 190 |
# κ³ μ μ΄λ―Έμ§ URL
|
| 191 |
+
#BG_URL = "https://plus.unsplash.com/premium_photo-1679830513869-cd3648acb1db?q=80&w=2127&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D"
|
| 192 |
|
| 193 |
+
COLOR = "#F1F1F1" # νμνλ©΄ μνλ HEXλ‘ λ³κ²½
|
| 194 |
+
# COLOR = st.sidebar.color_picker("λ°°κ²½μ", "#F1F1F1") # <- μ¬μ΄λλ°μμ κ³ λ₯΄κ³ μΆμΌλ©΄ μ΄ μ€ μ¬μ©
|
|
|
|
| 195 |
|
| 196 |
def apply_background():
|
| 197 |
+
st.markdown(f"""
|
|
|
|
| 198 |
<style>
|
| 199 |
+
/* μμ¬ λ°°κ²½ λ μ΄μ΄ μ κ±° */
|
| 200 |
+
.stApp::before, .stApp::after,
|
| 201 |
+
.block-container::before, .block-container::after {{ content: none !important; }}
|
| 202 |
+
.stApp {{ background: transparent !important; }}
|
| 203 |
+
|
| 204 |
+
/* μ€μ 컬λΌμλ§ λ¨μ λ°°κ²½ */
|
| 205 |
+
.block-container {{
|
| 206 |
+
position: relative;
|
| 207 |
+
min-height: 100vh; /* νλ©΄ λμ΄λ§νΌ μ±μ°κΈ° */
|
| 208 |
+
background: {COLOR} !important; /* λ¨μ */
|
| 209 |
+
}}
|
| 210 |
+
|
| 211 |
+
/* 컨ν
μΈ λ λ°°κ²½ μ */
|
| 212 |
+
.block-container > * {{ position: relative; z-index: 1; }}
|
| 213 |
+
|
| 214 |
+
/* (μ΅μ
) μ
λ ₯λ°μ€ μλ μ¬λ°± μ μ§ */
|
| 215 |
+
div[data-testid="stTextInput"] {{ margin-bottom: 18px !important; }}
|
| 216 |
</style>
|
| 217 |
+
""", unsafe_allow_html=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 218 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 219 |
apply_background()
|
| 220 |
|
| 221 |
+
# ββ P κΈκΌ΄ ν¬κΈ° 14 px βββββββββββββββββββββββββββββββββββ
|
| 222 |
+
st.markdown("""
|
| 223 |
+
<style>
|
| 224 |
+
/* κΈ°λ³Έ p νκ·Έ κΈκΌ΄ ν¬κΈ° */
|
| 225 |
+
html, body, p {
|
| 226 |
+
font-size: 14px !important; /* β 14 px κ³ μ */
|
| 227 |
+
line-height: 1.5; /* (μ ν) κ°λ
μ±μ μν μ€κ°κ²© */
|
| 228 |
+
}
|
| 229 |
+
|
| 230 |
+
/* Streamlit κΈ°λ³Έ λ§μ§ μ κ±°λ‘ λΆνμν μ¬λ°± λ°©μ§ (μ ν) */
|
| 231 |
+
p {
|
| 232 |
+
margin-top: 0;
|
| 233 |
+
margin-bottom: 0.5rem;
|
| 234 |
+
}
|
| 235 |
+
</style>
|
| 236 |
+
""", unsafe_allow_html=True)
|
| 237 |
+
|
| 238 |
# βββββββββββββββββββββββββββββββββββββ region mode
|
| 239 |
def region_ui(travel_df, external_score_df, festival_df, weather_df, package_df,
|
| 240 |
country_filter, city_filter, chat_container, log_and_render):
|