UCS2014 commited on
Commit
2883e97
·
verified ·
1 Parent(s): d933f43

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -14
app.py CHANGED
@@ -12,7 +12,7 @@ HERO_LOGO_SIZE = 180 # px (top company logo size)
12
  TOP_SPACER = 120 # px (breathing room above hero; raise if the logo looks "trimmed")
13
  CARD_WIDTH = 300 # px (fixed width per card on desktop)
14
  CARD_THUMB_HEIGHT = 180 # px (image area inside each card)
15
- GRID_GAP = 100 # px (space between the cards)
16
  BUTTON_TEXT = "Click to Run APP"
17
  OPEN_IN_NEW_TAB = False # True = open links in a new tab
18
 
@@ -26,7 +26,7 @@ APP1 = {
26
  "thumb": ASSETS / "app1.png",
27
  "blurb": "Real-Time UCS Prediction",
28
  "bg": "#F7FBFF", # very light blue
29
- "border":"#713F12", # light blue border
30
  }
31
  APP2 = {
32
  "title": "ST_Log_Ym",
@@ -34,16 +34,15 @@ APP2 = {
34
  "thumb": ASSETS / "app2.png",
35
  "blurb": "Real-Time Static Young's Modulus Prediction",
36
  "bg": "#F6FFF7", # very light green
37
- "border":"#713F12", # light green border
38
  }
39
- # NEW third card (edit title/url/blurb/thumb/colors as needed)
40
  APP3 = {
41
  "title": "ST_Third_App",
42
  "url": "https://example.com/", # <-- replace with your Space URL
43
  "thumb": ASSETS / "app3.png", # <-- upload this image
44
  "blurb": "Describe your third app here",
45
  "bg": "#F9F6FF", # very light purple
46
- "border":"#713F12", # light purple border
47
  }
48
 
49
  LOGO_PATH = ASSETS / "logo.png"
@@ -52,7 +51,7 @@ LOGO_PATH = ASSETS / "logo.png"
52
  page_icon = str(LOGO_PATH) if LOGO_PATH.exists() else "🧭"
53
  st.set_page_config(page_title=f"{COMPANY_NAME} — Apps", page_icon=page_icon, layout="wide")
54
 
55
- # ========= CSS (fits one screen on desktop; no blank area under cards) =========
56
  st.markdown(
57
  f"""
58
  <style>
@@ -82,7 +81,6 @@ st.markdown(
82
  display:block; margin: 0 auto 8px;
83
  filter: drop-shadow(0 2px 8px rgba(0,0,0,.12));
84
  }}
85
- /* Make tagline closer to the company name */
86
  .hero h1 {{ font-size: 2.3rem; margin: .2rem 0 0; }}
87
  .hero p {{
88
  color: #5a5f6a;
@@ -91,7 +89,7 @@ st.markdown(
91
  font-style: italic;
92
  }}
93
 
94
- /* GRID: precise card width + extra space above cards */
95
  .grid {{
96
  display: flex;
97
  gap: var(--grid-gap);
@@ -100,7 +98,6 @@ st.markdown(
100
  flex-wrap: nowrap; /* keep three across on desktop */
101
  margin-top: var(--grid-top-space);
102
  }}
103
- /* When viewport too narrow for 3-up, allow wrapping */
104
  @media (max-width: calc(3 * var(--card-width) + 2 * var(--grid-gap) + 64px)) {{
105
  .grid {{ flex-wrap: wrap; }}
106
  }}
@@ -113,6 +110,7 @@ st.markdown(
113
  box-shadow:0 4px 18px rgba(0,0,0,.05);
114
  transition:transform .12s ease, box-shadow .12s ease;
115
  text-align:center; display:flex; flex-direction:column; gap:10px;
 
116
  }}
117
  .card:hover {{ transform: translateY(-2px); box-shadow: 0 10px 28px rgba(0,0,0,.08); }}
118
 
@@ -125,14 +123,19 @@ st.markdown(
125
  background:#fff;
126
  }}
127
 
128
- .card h3 {{ margin:6px 0 2px; }}
129
- .card p {{ color:#5a5f6a; min-height:30px; margin:0 8px 2px; }}
 
 
 
130
 
131
- /* Light button with dark text */
132
  .btn {{
133
  display:inline-block; padding:10px 14px; border-radius:12px;
134
  border:1px solid #e5e7eb; text-decoration:none;
135
  background:#f3f4f6; color:#111827; font-weight:500;
 
 
136
  }}
137
  .btn:hover {{ background:#e5e7eb; }}
138
 
@@ -180,10 +183,9 @@ def app_card(app: dict) -> str:
180
  + "</div>"
181
  )
182
 
183
- # Render 3 cards side-by-side
184
  st.markdown("<div class='grid'>" + app_card(APP1) + app_card(APP2) + app_card(APP3) + "</div>", unsafe_allow_html=True)
185
 
186
- # ========= FOOTER (compact; no extra spacing) =========
187
  st.markdown(
188
  """
189
  <hr>
 
12
  TOP_SPACER = 120 # px (breathing room above hero; raise if the logo looks "trimmed")
13
  CARD_WIDTH = 300 # px (fixed width per card on desktop)
14
  CARD_THUMB_HEIGHT = 180 # px (image area inside each card)
15
+ GRID_GAP = 100 # px (space between the cards)
16
  BUTTON_TEXT = "Click to Run APP"
17
  OPEN_IN_NEW_TAB = False # True = open links in a new tab
18
 
 
26
  "thumb": ASSETS / "app1.png",
27
  "blurb": "Real-Time UCS Prediction",
28
  "bg": "#F7FBFF", # very light blue
29
+ "border":"#713F12", # accent border
30
  }
31
  APP2 = {
32
  "title": "ST_Log_Ym",
 
34
  "thumb": ASSETS / "app2.png",
35
  "blurb": "Real-Time Static Young's Modulus Prediction",
36
  "bg": "#F6FFF7", # very light green
37
+ "border":"#713F12",
38
  }
 
39
  APP3 = {
40
  "title": "ST_Third_App",
41
  "url": "https://example.com/", # <-- replace with your Space URL
42
  "thumb": ASSETS / "app3.png", # <-- upload this image
43
  "blurb": "Describe your third app here",
44
  "bg": "#F9F6FF", # very light purple
45
+ "border":"#713F12",
46
  }
47
 
48
  LOGO_PATH = ASSETS / "logo.png"
 
51
  page_icon = str(LOGO_PATH) if LOGO_PATH.exists() else "🧭"
52
  st.set_page_config(page_title=f"{COMPANY_NAME} — Apps", page_icon=page_icon, layout="wide")
53
 
54
+ # ========= CSS (fits one screen on desktop; centered titles & buttons) =========
55
  st.markdown(
56
  f"""
57
  <style>
 
81
  display:block; margin: 0 auto 8px;
82
  filter: drop-shadow(0 2px 8px rgba(0,0,0,.12));
83
  }}
 
84
  .hero h1 {{ font-size: 2.3rem; margin: .2rem 0 0; }}
85
  .hero p {{
86
  color: #5a5f6a;
 
89
  font-style: italic;
90
  }}
91
 
92
+ /* GRID */
93
  .grid {{
94
  display: flex;
95
  gap: var(--grid-gap);
 
98
  flex-wrap: nowrap; /* keep three across on desktop */
99
  margin-top: var(--grid-top-space);
100
  }}
 
101
  @media (max-width: calc(3 * var(--card-width) + 2 * var(--grid-gap) + 64px)) {{
102
  .grid {{ flex-wrap: wrap; }}
103
  }}
 
110
  box-shadow:0 4px 18px rgba(0,0,0,.05);
111
  transition:transform .12s ease, box-shadow .12s ease;
112
  text-align:center; display:flex; flex-direction:column; gap:10px;
113
+ align-items: center; /* center children horizontally */
114
  }}
115
  .card:hover {{ transform: translateY(-2px); box-shadow: 0 10px 28px rgba(0,0,0,.08); }}
116
 
 
123
  background:#fff;
124
  }}
125
 
126
+ .card h3, .card p {{
127
+ text-align: center; /* center text */
128
+ width: 100%;
129
+ }}
130
+ .card p {{ color:#5a5f6a; min-height:30px; margin:0 8px 2px; }}
131
 
132
+ /* Light button with dark text — centered */
133
  .btn {{
134
  display:inline-block; padding:10px 14px; border-radius:12px;
135
  border:1px solid #e5e7eb; text-decoration:none;
136
  background:#f3f4f6; color:#111827; font-weight:500;
137
+ margin: 2px auto 0; /* center via auto margins */
138
+ align-self: center; /* and ensure flex centering */
139
  }}
140
  .btn:hover {{ background:#e5e7eb; }}
141
 
 
183
  + "</div>"
184
  )
185
 
 
186
  st.markdown("<div class='grid'>" + app_card(APP1) + app_card(APP2) + app_card(APP3) + "</div>", unsafe_allow_html=True)
187
 
188
+ # ========= FOOTER =========
189
  st.markdown(
190
  """
191
  <hr>