UCS2014 commited on
Commit
7ebdbd1
·
verified ·
1 Parent(s): 380507d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +51 -47
app.py CHANGED
@@ -21,50 +21,48 @@ THEME: Dict[str, Any] = {
21
  "pill_pad_h": 14, # px
22
  "pill_font": 16, # px
23
  "tagline_font": 15, # px
24
- # Premium header palette
25
- "bg1": "#0B1220", # charcoal
26
- "bg2": "#142136", # deep navy
27
- "text": "#E4B83A", # gold text inside pill
28
- "tagline_color": "#475569",
29
  },
30
  "page": {
31
- "top_padding": 50, # px top padding for page
32
- "container_width": 1120, # max content width
33
- "bg_radial": True, # premium faint radial bg
34
  },
35
  "hero": {
36
- "width": 400, # px
37
- "margin_bottom": 30, # px space under hero
38
  "logo": ASSETS / "AI_Suite_Log_logo.png",
39
  },
40
  "grid": {
41
- "gap": 50, # px between cards
42
- "card_width": 340, # default card width (px)
43
  },
44
  "card": {
45
- "radius": 22, # px
46
- "border_width": 2, # px
47
- "pad_v": 24, # px
48
- "pad_h": 20, # px
49
- "border": "#0B1220", # dark outline
50
  "border_hover": "#243447",
51
- # defaults (overridden per card below)
52
  "bg_top": "#FFFFFF",
53
  "bg_bot": "#FBFCFE",
54
  "title_color": "#0B1220",
55
  "blurb_color": "#566275",
56
  },
57
  "icon": {
58
- "diam": 118, # px outer circle
59
- "img": 106, # px image
60
  "circle_bg": "#F1F5F9",
61
  "circle_border": "rgba(12,18,32,0.10)",
62
  },
63
  "button": {
64
- "pad_v": 12, # px
65
- "pad_h": 20, # px
66
- "radius": 14, # px
67
- # premium navy CTA
68
  "bg1": "#0B1220",
69
  "bg2": "#162338",
70
  "text": "#FFFFFF",
@@ -72,8 +70,7 @@ THEME: Dict[str, Any] = {
72
  },
73
  }
74
 
75
- # ========= CARDS (content + per-card overrides) =========
76
- # Solid, very-light tints for a premium feel (no washed-out rgba)
77
  CARDS = [
78
  {
79
  "title": " ST_Log_GR",
@@ -81,7 +78,7 @@ CARDS = [
81
  "url": "https://smart-thinking-gr.hf.space/",
82
  "icon": ASSETS / "GR_logo.png",
83
  "style": {
84
- "bg_top": "#EAF7F1", # minty light
85
  "bg_bot": "#F6FBF8",
86
  "border": "#0F3D3E",
87
  },
@@ -92,7 +89,7 @@ CARDS = [
92
  "url": "https://smart-thinking-sonic-ts.hf.space",
93
  "icon": ASSETS / "Ts_logo.png",
94
  "style": {
95
- "bg_top": "#EAF7FD", # airy cyan
96
  "bg_bot": "#F5FBFF",
97
  "border": "#0E4A6E",
98
  },
@@ -103,7 +100,7 @@ CARDS = [
103
  "url": "https://smart-thinking-sonic-tc.hf.space",
104
  "icon": ASSETS / "Tc_logo.png",
105
  "style": {
106
- "bg_top": "#EEF0FF", # soft indigo
107
  "bg_bot": "#F7F8FF",
108
  "border": "#3E4EB8",
109
  },
@@ -128,7 +125,7 @@ def img_tag(path: Path, alt: str, cls: str = "", style: str = "") -> str:
128
  style_attr = f' style="{style}"' if style else ""
129
  return f'<img{cls_attr}{style_attr} src="{uri}" alt="{escape(alt)}" />'
130
 
131
- # ========= CSS (driven from THEME) =========
132
  strip = THEME["strip"]; page = THEME["page"]; hero = THEME["hero"]
133
  grid = THEME["grid"]; card = THEME["card"]; icon = THEME["icon"]; button = THEME["button"]
134
 
@@ -245,7 +242,6 @@ st.markdown(f"""
245
  padding: var(--c-pv, var(--card-pv)) var(--c-ph, var(--card-ph));
246
  background: linear-gradient(180deg, var(--c-bg-top, {card["bg_top"]}) 0%, var(--c-bg-bot, {card["bg_bot"]}) 100%);
247
  border: var(--c-bw, var(--card-bw)) solid var(--c-border, var(--cardStroke));
248
- /* Softer inner highlights → color shows more, keeps 3D */
249
  box-shadow:
250
  0 14px 32px rgba(2,20,35,.12),
251
  0 1px 0 rgba(255,255,255,0.70) inset,
@@ -258,11 +254,12 @@ st.markdown(f"""
258
  border-color: var(--cardStrokeHover);
259
  box-shadow:
260
  0 22px 56px rgba(2,20,35,.18),
261
- 0 1px 0 rgba(255,255,255,0.82) inset,
262
- 0 -1px 10px rgba(255,255,255,0.28) inset;
263
  filter: saturate(1.03);
264
  }}
265
 
 
266
  .icon-wrap {{
267
  width: var(--c-icon-d, {icon["diam"]}px); height: var(--c-icon-d, {icon["diam"]}px);
268
  border-radius: 9999px; display:grid; place-items:center;
@@ -271,8 +268,15 @@ st.markdown(f"""
271
  box-shadow: inset 0 1px 0 rgba(255,255,255,.95), 0 10px 22px rgba(2,20,35,.07);
272
  }}
273
  .icon-wrap img {{
274
- width: var(--c-icon-img, {icon["img"]}px); height: var(--c-icon-img, {icon["img"]}px);
275
- border-radius:9999px; display:block;
 
 
 
 
 
 
 
276
  }}
277
 
278
  .card h3 {{
@@ -334,21 +338,21 @@ def build_card_vars(style: Dict[str, Any]) -> str:
334
  if "bg_bot" in style: s.append(f"--c-bg-bot:{style['bg_bot']}")
335
  if "border" in style: s.append(f"--c-border:{style['border']}")
336
  if "border_width" in style: s.append(f"--c-bw:{int(style['border_width'])}px")
337
- if "title_color" in style: s.append(f"--c-title-color:{style['title_color']}")
338
  if "title_fs" in style: s.append(f"--c-title-fs:{int(style['title_fs'])}px")
339
- if "blurb_color" in style: s.append(f"--c-blurb-color:{style['blurb_color']}")
340
  if "blurb_fs" in style: s.append(f"--c-blurb-fs:{int(style['blurb_fs'])}px")
341
- if "btn_bg1" in style: s.append(f"--c-btn-bg1:{style['btn_bg1']}")
342
- if "btn_bg2" in style: s.append(f"--c-btn-bg2:{style['btn_bg2']}")
343
- if "btn_text" in style: s.append(f"--c-btn-text:{style['btn_text']}")
344
- if "btn_border" in style: s.append(f"--c-btn-border:{style['btn_border']}")
345
  if "btn_fs" in style: s.append(f"--c-btn-fs:{int(style['btn_fs'])}px")
346
- if "btn_pad_v" in style: s.append(f"--c-btn-pv:{int(style['btn_pad_v'])}px")
347
- if "btn_pad_h" in style: s.append(f"--c-btn-ph:{int(style['btn_pad_h'])}px")
348
- if "icon_diam" in style: s.append(f"--c-icon-d:{int(style['icon_diam'])}px")
349
- if "icon_img" in style: s.append(f"--c-icon-img:{int(style['icon_img'])}px")
350
- if "icon_bg" in style: s.append(f"--c-icon-bg:{style['icon_bg']}")
351
- if "icon_border" in style: s.append(f"--c-icon-border:{style['icon_border']}")
352
  return "; ".join(s)
353
 
354
  def app_card(card_cfg: Dict[str, Any]) -> str:
 
21
  "pill_pad_h": 14, # px
22
  "pill_font": 16, # px
23
  "tagline_font": 15, # px
24
+ # GOLD header palette (high contrast)
25
+ "bg1": "#D4AF37", # gold
26
+ "bg2": "#B88917", # deeper gold
27
+ "text": "#0B1220", # dark text in pill for contrast
28
+ "tagline_color": "#000000",
29
  },
30
  "page": {
31
+ "top_padding": 50,
32
+ "container_width": 1120,
33
+ "bg_radial": True,
34
  },
35
  "hero": {
36
+ "width": 400,
37
+ "margin_bottom": 30,
38
  "logo": ASSETS / "AI_Suite_Log_logo.png",
39
  },
40
  "grid": {
41
+ "gap": 50,
42
+ "card_width": 340,
43
  },
44
  "card": {
45
+ "radius": 22,
46
+ "border_width": 2,
47
+ "pad_v": 24,
48
+ "pad_h": 20,
49
+ "border": "#0B1220",
50
  "border_hover": "#243447",
 
51
  "bg_top": "#FFFFFF",
52
  "bg_bot": "#FBFCFE",
53
  "title_color": "#0B1220",
54
  "blurb_color": "#566275",
55
  },
56
  "icon": {
57
+ "diam": 118,
58
+ "img": 106,
59
  "circle_bg": "#F1F5F9",
60
  "circle_border": "rgba(12,18,32,0.10)",
61
  },
62
  "button": {
63
+ "pad_v": 12,
64
+ "pad_h": 20,
65
+ "radius": 14,
 
66
  "bg1": "#0B1220",
67
  "bg2": "#162338",
68
  "text": "#FFFFFF",
 
70
  },
71
  }
72
 
73
+ # ========= CARDS =========
 
74
  CARDS = [
75
  {
76
  "title": " ST_Log_GR",
 
78
  "url": "https://smart-thinking-gr.hf.space/",
79
  "icon": ASSETS / "GR_logo.png",
80
  "style": {
81
+ "bg_top": "#EAF7F1",
82
  "bg_bot": "#F6FBF8",
83
  "border": "#0F3D3E",
84
  },
 
89
  "url": "https://smart-thinking-sonic-ts.hf.space",
90
  "icon": ASSETS / "Ts_logo.png",
91
  "style": {
92
+ "bg_top": "#EAF7FD",
93
  "bg_bot": "#F5FBFF",
94
  "border": "#0E4A6E",
95
  },
 
100
  "url": "https://smart-thinking-sonic-tc.hf.space",
101
  "icon": ASSETS / "Tc_logo.png",
102
  "style": {
103
+ "bg_top": "#EEF0FF",
104
  "bg_bot": "#F7F8FF",
105
  "border": "#3E4EB8",
106
  },
 
125
  style_attr = f' style="{style}"' if style else ""
126
  return f'<img{cls_attr}{style_attr} src="{uri}" alt="{escape(alt)}" />'
127
 
128
+ # ========= CSS =========
129
  strip = THEME["strip"]; page = THEME["page"]; hero = THEME["hero"]
130
  grid = THEME["grid"]; card = THEME["card"]; icon = THEME["icon"]; button = THEME["button"]
131
 
 
242
  padding: var(--c-pv, var(--card-pv)) var(--c-ph, var(--card-ph));
243
  background: linear-gradient(180deg, var(--c-bg-top, {card["bg_top"]}) 0%, var(--c-bg-bot, {card["bg_bot"]}) 100%);
244
  border: var(--c-bw, var(--card-bw)) solid var(--c-border, var(--cardStroke));
 
245
  box-shadow:
246
  0 14px 32px rgba(2,20,35,.12),
247
  0 1px 0 rgba(255,255,255,0.70) inset,
 
254
  border-color: var(--cardStrokeHover);
255
  box-shadow:
256
  0 22px 56px rgba(2,20,35,.18),
257
+ 0 1px 0 rgba(255,255,255,.82) inset,
258
+ 0 -1px 10px rgba(255,255,255,.28) inset;
259
  filter: saturate(1.03);
260
  }}
261
 
262
+ /* ===== ICON / LOGO — self-contained, not trimmed ===== */
263
  .icon-wrap {{
264
  width: var(--c-icon-d, {icon["diam"]}px); height: var(--c-icon-d, {icon["diam"]}px);
265
  border-radius: 9999px; display:grid; place-items:center;
 
268
  box-shadow: inset 0 1px 0 rgba(255,255,255,.95), 0 10px 22px rgba(2,20,35,.07);
269
  }}
270
  .icon-wrap img {{
271
+ width: calc(var(--c-icon-img, {icon["img"]}px) - 12px);
272
+ height: calc(var(--c-icon-img, {icon["img"]}px) - 12px);
273
+ padding: 6px;
274
+ box-sizing: border-box;
275
+ object-fit: contain; /* never crop */
276
+ background: #FFFFFF; /* clean canvas for mixed logos */
277
+ border: 2px solid var(--c-border, var(--cardStroke)); /* match card border */
278
+ border-radius: 14px;
279
+ display:block;
280
  }}
281
 
282
  .card h3 {{
 
338
  if "bg_bot" in style: s.append(f"--c-bg-bot:{style['bg_bot']}")
339
  if "border" in style: s.append(f"--c-border:{style['border']}")
340
  if "border_width" in style: s.append(f"--c-bw:{int(style['border_width'])}px")
341
+ if "title_color" in style: s.append(f"--c-title-color:{style['title_color"]}")
342
  if "title_fs" in style: s.append(f"--c-title-fs:{int(style['title_fs'])}px")
343
+ if "blurb_color" in style: s.append(f"--c-blurb-color:{style['blurb_color"]}")
344
  if "blurb_fs" in style: s.append(f"--c-blurb-fs:{int(style['blurb_fs'])}px")
345
+ if "btn_bg1" in style: s.append(f"--c-btn-bg1:{style['btn_bg1"]}")
346
+ if "btn_bg2" in style: s.append(f"--c-btn-bg2:{style['btn_bg2"]}")
347
+ if "btn_text" in style: s.append(f"--c-btn-text:{style['btn_text"]}")
348
+ if "btn_border" in style: s.append(f"--c-btn-border:{style['btn_border"]}")
349
  if "btn_fs" in style: s.append(f"--c-btn-fs:{int(style['btn_fs'])}px")
350
+ if "btn_pad_v" in style: s.append(f"--c-btn-pv:{int(style['btn_pad_v"]) }px")
351
+ if "btn_pad_h" in style: s.append(f"--c-btn-ph:{int(style['btn_pad_h"]) }px")
352
+ if "icon_diam" in style: s.append(f"--c-icon-d:{int(style['icon_diam"]) }px")
353
+ if "icon_img" in style: s.append(f"--c-icon-img:{int(style['icon_img"]) }px")
354
+ if "icon_bg" in style: s.append(f"--c-icon-bg:{style['icon_bg"]}")
355
+ if "icon_border" in style: s.append(f"--c-icon-border:{style['icon_border"]}")
356
  return "; ".join(s)
357
 
358
  def app_card(card_cfg: Dict[str, Any]) -> str: