Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -25,12 +25,16 @@ APP1 = {
|
|
| 25 |
"url": "https://smart-thinking-ucs.hf.space/",
|
| 26 |
"thumb": ASSETS / "app1.png",
|
| 27 |
"blurb": "Real-Time UCS Prediction",
|
|
|
|
|
|
|
| 28 |
}
|
| 29 |
APP2 = {
|
| 30 |
"title": "ST_Log_GR",
|
| 31 |
"url": "https://smart-thinking-gr.hf.space/",
|
| 32 |
"thumb": ASSETS / "app2.png",
|
| 33 |
"blurb": "Real-Time GR Log Prediction",
|
|
|
|
|
|
|
| 34 |
}
|
| 35 |
LOGO_PATH = ASSETS / "logo.png"
|
| 36 |
|
|
@@ -49,15 +53,14 @@ st.markdown(
|
|
| 49 |
}}
|
| 50 |
|
| 51 |
html, body, [data-testid="stAppViewContainer"] {{ height: 100%; }}
|
| 52 |
-
/* Remove Streamlit's default big paddings to reclaim space */
|
| 53 |
[data-testid="stAppViewContainer"] > .main {{ padding-top: 0 !important; padding-bottom: 0 !important; }}
|
| 54 |
.block-container {{
|
| 55 |
max-width: 1120px;
|
| 56 |
-
min-height: 100vh;
|
| 57 |
display: flex; flex-direction: column;
|
| 58 |
-
justify-content: center;
|
| 59 |
gap: 10px;
|
| 60 |
-
padding: var(--top-spacer) 0 8px !important;
|
| 61 |
}}
|
| 62 |
|
| 63 |
/* HERO */
|
|
@@ -70,24 +73,23 @@ st.markdown(
|
|
| 70 |
.hero h1 {{ font-size: 2.3rem; margin: .4rem 0 .2rem; }}
|
| 71 |
.hero p {{ color: #5a5f6a; margin: 0 auto; max-width: 720px; }}
|
| 72 |
|
| 73 |
-
/* GRID:
|
| 74 |
.grid {{
|
| 75 |
display: flex;
|
| 76 |
gap: var(--grid-gap);
|
| 77 |
justify-content: center;
|
| 78 |
align-items: stretch;
|
| 79 |
-
flex-wrap: nowrap;
|
| 80 |
}}
|
| 81 |
-
|
| 82 |
-
/* If the screen is too small, allow wrapping to avoid horizontal scroll */
|
| 83 |
@media (max-width: calc(2 * var(--card-width) + var(--grid-gap) + 64px)) {{
|
| 84 |
.grid {{ flex-wrap: wrap; }}
|
| 85 |
}}
|
| 86 |
|
| 87 |
.card {{
|
| 88 |
width: var(--card-width);
|
| 89 |
-
background
|
| 90 |
-
border:1px solid rgba(0,0,0,.06);
|
|
|
|
| 91 |
box-shadow:0 4px 18px rgba(0,0,0,.05);
|
| 92 |
transition:transform .12s ease, box-shadow .12s ease;
|
| 93 |
text-align:center; display:flex; flex-direction:column; gap:10px;
|
|
@@ -99,7 +101,7 @@ st.markdown(
|
|
| 99 |
height: {CARD_THUMB_HEIGHT}px;
|
| 100 |
border-radius:14px;
|
| 101 |
border:1px solid rgba(0,0,0,.06);
|
| 102 |
-
object-fit: contain;
|
| 103 |
background:#fff;
|
| 104 |
}}
|
| 105 |
|
|
@@ -149,8 +151,9 @@ st.markdown(
|
|
| 149 |
# ========= CARDS =========
|
| 150 |
def app_card(app: dict) -> str:
|
| 151 |
target = "_blank" if OPEN_IN_NEW_TAB else "_self"
|
|
|
|
| 152 |
return (
|
| 153 |
-
"<div class='card'>"
|
| 154 |
+ img_tag(app["thumb"], app["title"], "thumb")
|
| 155 |
+ f"<h3>{escape(app['title'])}</h3>"
|
| 156 |
+ f"<p>{escape(app['blurb'])}</p>"
|
|
@@ -170,4 +173,4 @@ st.markdown(
|
|
| 170 |
</div>
|
| 171 |
""",
|
| 172 |
unsafe_allow_html=True,
|
| 173 |
-
)
|
|
|
|
| 25 |
"url": "https://smart-thinking-ucs.hf.space/",
|
| 26 |
"thumb": ASSETS / "app1.png",
|
| 27 |
"blurb": "Real-Time UCS Prediction",
|
| 28 |
+
"bg": "#F7FBFF", # very light blue
|
| 29 |
+
"border":"#E8F2FF", # light blue border
|
| 30 |
}
|
| 31 |
APP2 = {
|
| 32 |
"title": "ST_Log_GR",
|
| 33 |
"url": "https://smart-thinking-gr.hf.space/",
|
| 34 |
"thumb": ASSETS / "app2.png",
|
| 35 |
"blurb": "Real-Time GR Log Prediction",
|
| 36 |
+
"bg": "#F6FFF7", # very light green
|
| 37 |
+
"border":"#E4F9E6", # light green border
|
| 38 |
}
|
| 39 |
LOGO_PATH = ASSETS / "logo.png"
|
| 40 |
|
|
|
|
| 53 |
}}
|
| 54 |
|
| 55 |
html, body, [data-testid="stAppViewContainer"] {{ height: 100%; }}
|
|
|
|
| 56 |
[data-testid="stAppViewContainer"] > .main {{ padding-top: 0 !important; padding-bottom: 0 !important; }}
|
| 57 |
.block-container {{
|
| 58 |
max-width: 1120px;
|
| 59 |
+
min-height: 100vh;
|
| 60 |
display: flex; flex-direction: column;
|
| 61 |
+
justify-content: center;
|
| 62 |
gap: 10px;
|
| 63 |
+
padding: var(--top-spacer) 0 8px !important;
|
| 64 |
}}
|
| 65 |
|
| 66 |
/* HERO */
|
|
|
|
| 73 |
.hero h1 {{ font-size: 2.3rem; margin: .4rem 0 .2rem; }}
|
| 74 |
.hero p {{ color: #5a5f6a; margin: 0 auto; max-width: 720px; }}
|
| 75 |
|
| 76 |
+
/* GRID: precise card width */
|
| 77 |
.grid {{
|
| 78 |
display: flex;
|
| 79 |
gap: var(--grid-gap);
|
| 80 |
justify-content: center;
|
| 81 |
align-items: stretch;
|
| 82 |
+
flex-wrap: nowrap;
|
| 83 |
}}
|
|
|
|
|
|
|
| 84 |
@media (max-width: calc(2 * var(--card-width) + var(--grid-gap) + 64px)) {{
|
| 85 |
.grid {{ flex-wrap: wrap; }}
|
| 86 |
}}
|
| 87 |
|
| 88 |
.card {{
|
| 89 |
width: var(--card-width);
|
| 90 |
+
background: var(--card-bg, #fff);
|
| 91 |
+
border: 1px solid var(--card-border, rgba(0,0,0,.06));
|
| 92 |
+
border-radius:16px; padding:14px;
|
| 93 |
box-shadow:0 4px 18px rgba(0,0,0,.05);
|
| 94 |
transition:transform .12s ease, box-shadow .12s ease;
|
| 95 |
text-align:center; display:flex; flex-direction:column; gap:10px;
|
|
|
|
| 101 |
height: {CARD_THUMB_HEIGHT}px;
|
| 102 |
border-radius:14px;
|
| 103 |
border:1px solid rgba(0,0,0,.06);
|
| 104 |
+
object-fit: contain;
|
| 105 |
background:#fff;
|
| 106 |
}}
|
| 107 |
|
|
|
|
| 151 |
# ========= CARDS =========
|
| 152 |
def app_card(app: dict) -> str:
|
| 153 |
target = "_blank" if OPEN_IN_NEW_TAB else "_self"
|
| 154 |
+
style = f"--card-bg:{app.get('bg','#fff')}; --card-border:{app.get('border','rgba(0,0,0,.06)')};"
|
| 155 |
return (
|
| 156 |
+
f"<div class='card' style='{style}'>"
|
| 157 |
+ img_tag(app["thumb"], app["title"], "thumb")
|
| 158 |
+ f"<h3>{escape(app['title'])}</h3>"
|
| 159 |
+ f"<p>{escape(app['blurb'])}</p>"
|
|
|
|
| 173 |
</div>
|
| 174 |
""",
|
| 175 |
unsafe_allow_html=True,
|
| 176 |
+
)
|