UCS2014 commited on
Commit
6849280
·
verified ·
1 Parent(s): 9411543

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +49 -37
app.py CHANGED
@@ -1,29 +1,26 @@
1
-
2
  import streamlit as st
 
3
 
4
  # ------------ CONFIG ------------
5
- COMPANY_NAME = "Smart Thinking"
6
- TAGLINE = "We Deliver Smart AI-Based Solutions For O&G Industry"
7
  APP1 = {
8
- "title": "ST_GeoMech_UCS",
9
- "url": "https://smart-thinking-ucs.hf.space/",
10
  "thumb": "assets/app1.png",
11
- "blurb": "Real-Time UCS Prediction",
12
  }
13
  APP2 = {
14
- "title": "ST_Log_GR",
15
- "url": "https://smart-thinking-gr.hf.space/",
16
  "thumb": "assets/app2.png",
17
- "blurb": "Real-Time GR Log Prediction",
18
  }
19
- LOGO_PATH = "assets/logo.png"
20
 
21
  # ------------ PAGE META ------------
22
- st.set_page_config(
23
- page_title=f"{COMPANY_NAME} — Apps",
24
- page_icon=LOGO_PATH,
25
- layout="wide",
26
- )
27
 
28
  # ------------ GLOBAL STYLES ------------
29
  st.markdown(
@@ -37,15 +34,14 @@ st.markdown(
37
  .grid {display:grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px;}
38
  .card {background: white; border-radius: 18px; padding: 18px; border: 1px solid rgba(0,0,0,.06);
39
  box-shadow: 0 4px 18px rgba(0,0,0,.05); transition: transform .12s ease, box-shadow .12s ease;}
40
- .card:hover {transform: translateY(-2px); box-shadow: 0 10px 28px rgba(0,0,0,.08);}
41
- .thumb {border-radius: 14px; width: 100%; height: 220px; object-fit: cover; border: 1px solid rgba(0,0,0,.06);}
 
42
  .card h3 {margin: 12px 0 6px;}
43
  .card p {color: #5a5f6a; min-height: 40px;}
44
  .card a.btn {display:inline-block; padding: 10px 14px; border-radius: 12px; border: 1px solid #e6e7ea; text-decoration:none;}
45
  .btn-primary {background:#111827; color:white; border-color:#111827;}
46
- .btn-primary:hover {filter: brightness(0.92);}
47
-
48
- /* Make Streamlit body a tad wider */
49
  .block-container {max-width: 1120px;}
50
  </style>
51
  """,
@@ -53,27 +49,43 @@ st.markdown(
53
  )
54
 
55
  # ------------ HERO ------------
56
- st.markdown('<div class="hero">'
57
- f'<img src="{LOGO_PATH}" alt="logo" />'
58
- f'<h1>{COMPANY_NAME}</h1>' \
59
- f'<p>{TAGLINE}</p>'
60
- '</div>', unsafe_allow_html=True)
 
 
 
 
 
 
61
 
62
- # ------------ GRID (2 CARDS) ------------
63
- def app_card(app_dict):
 
 
 
 
 
 
 
64
  return f"""
65
- <div class=card>
66
- <img class=thumb src="{app_dict['thumb']}" alt="{app_dict['title']}" />
67
- <h3>{app_dict['title']}</h3>
68
- <p>{app_dict['blurb']}</p>
69
- <a class="btn btn-primary" href="{app_dict['url']}" target="_self">Open {app_dict['title']}</a>
70
  </div>
71
  """
72
 
 
 
 
 
 
 
73
  st.markdown(
74
- f"<div class='grid'>{app_card(APP1)}{app_card(APP2)}</div>",
75
  unsafe_allow_html=True,
76
- )
77
-
78
- # ------------ FOOTER (optional) ------------
79
- st.markdown("\n\n<div style='text-align:center; color:#8a9099; font-size: 0.9rem;'>© {}</div>".format(COMPANY_NAME), unsafe_allow_html=True)
 
 
1
  import streamlit as st
2
+ from pathlib import Path
3
 
4
  # ------------ CONFIG ------------
5
+ COMPANY_NAME = "YOUR_COMPANY_NAME"
6
+ TAGLINE = "Short value proposition goes here."
7
  APP1 = {
8
+ "title": "YOUR_APP1_TITLE",
9
+ "url": "https://huggingface.co/spaces/YOUR_ORG/YOUR_APP1_SPACE",
10
  "thumb": "assets/app1.png",
11
+ "blurb": "One-line description for App 1.",
12
  }
13
  APP2 = {
14
+ "title": "YOUR_APP2_TITLE",
15
+ "url": "https://huggingface.co/spaces/YOUR_ORG/YOUR_APP2_SPACE",
16
  "thumb": "assets/app2.png",
17
+ "blurb": "One-line description for App 2.",
18
  }
19
+ LOGO_PATH = Path("assets/logo.png")
20
 
21
  # ------------ PAGE META ------------
22
+ page_icon = str(LOGO_PATH) if LOGO_PATH.exists() else "🧭"
23
+ st.set_page_config(page_title=f"{COMPANY_NAME} — Apps", page_icon=page_icon, layout="wide")
 
 
 
24
 
25
  # ------------ GLOBAL STYLES ------------
26
  st.markdown(
 
34
  .grid {display:grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px;}
35
  .card {background: white; border-radius: 18px; padding: 18px; border: 1px solid rgba(0,0,0,.06);
36
  box-shadow: 0 4px 18px rgba(0,0,0,.05); transition: transform .12s ease, box-shadow .12s ease;}
37
+ .card:hover {transform: translateY(-2px); box-shadow: 0 10px 28px rgba(0,0,0,.08);}
38
+ .thumb {border-radius: 14px; width: 100%; height: 220px; object-fit: cover; border: 1px solid rgba(0,0,0,.06);
39
+ display:flex; align-items:center; justify-content:center; color:#50545c; background:linear-gradient(180deg,#f6f7fb,#eceff4);}
40
  .card h3 {margin: 12px 0 6px;}
41
  .card p {color: #5a5f6a; min-height: 40px;}
42
  .card a.btn {display:inline-block; padding: 10px 14px; border-radius: 12px; border: 1px solid #e6e7ea; text-decoration:none;}
43
  .btn-primary {background:#111827; color:white; border-color:#111827;}
44
+ .btn-primary:hover {filter: brightness(0.92);}
 
 
45
  .block-container {max-width: 1120px;}
46
  </style>
47
  """,
 
49
  )
50
 
51
  # ------------ HERO ------------
52
+ logo_html = (
53
+ f'<img src="{LOGO_PATH.as_posix()}" alt="logo" />' if LOGO_PATH.exists() else ""
54
+ )
55
+ st.markdown(
56
+ '<div class="hero">'
57
+ + logo_html
58
+ + f"<h1>{COMPANY_NAME}</h1>"
59
+ + f"<p>{TAGLINE}</p>"
60
+ + "</div>",
61
+ unsafe_allow_html=True,
62
+ )
63
 
64
+ # ------------ HELPERS ------------
65
+ from html import escape
66
+ def img_or_placeholder(src: str, alt: str):
67
+ p = Path(src)
68
+ if p.exists():
69
+ return f'<img class="thumb" src="{escape(src)}" alt="{escape(alt)}" />'
70
+ return f'<div class="thumb">{escape(alt)}</div>'
71
+
72
+ def app_card(app_dict: dict) -> str:
73
  return f"""
74
+ <div class="card">
75
+ {img_or_placeholder(app_dict['thumb'], app_dict['title'])}
76
+ <h3>{escape(app_dict['title'])}</h3>
77
+ <p>{escape(app_dict['blurb'])}</p>
78
+ <a class="btn btn-primary" href="{escape(app_dict['url'])}" target="_self">Open {escape(app_dict['title'])}</a>
79
  </div>
80
  """
81
 
82
+ # ------------ GRID (2 CARDS) ------------
83
+ card1 = app_card(APP1)
84
+ card2 = app_card(APP2)
85
+ st.markdown(f"<div class='grid'>{card1}{card2}</div>", unsafe_allow_html=True)
86
+
87
+ # ------------ FOOTER ------------
88
  st.markdown(
89
+ f"\n\n<div style='text-align:center; color:#8a9099; font-size: 0.9rem;'{escape(COMPANY_NAME)}</div>",
90
  unsafe_allow_html=True,
91
+ )