Sathwikchowdary commited on
Commit
0b5e0d8
·
verified ·
1 Parent(s): fdd2160

Update Home.py

Browse files
Files changed (1) hide show
  1. Home.py +32 -38
Home.py CHANGED
@@ -1,7 +1,9 @@
1
  import streamlit as st
 
 
2
  from streamlit_extras.switch_page_button import switch_page
3
 
4
- # Load background image
5
  def get_base64_bg(image_path):
6
  with open(image_path, "rb") as img_file:
7
  encoded = base64.b64encode(img_file.read()).decode()
@@ -9,7 +11,7 @@ def get_base64_bg(image_path):
9
 
10
  background_img = get_base64_bg("background.jpg")
11
 
12
- # Set the background using encoded image
13
  st.markdown(
14
  f"""
15
  <style>
@@ -52,10 +54,6 @@ st.markdown(
52
  border-radius: 10px;
53
  margin-bottom: 20px;
54
  }}
55
- .button-container {{
56
- text-align: center;
57
- margin-top: 20px;
58
- }}
59
  .footer {{
60
  font-size: 14px;
61
  color: #333;
@@ -68,10 +66,7 @@ st.markdown(
68
  unsafe_allow_html=True
69
  )
70
 
71
- # 👇 Rest of your app (header, content, buttons) remains unchanged from the previous message.
72
-
73
-
74
- # Header with Logo
75
  st.markdown(
76
  """
77
  <div class='header'>
@@ -82,51 +77,50 @@ st.markdown(
82
  unsafe_allow_html=True
83
  )
84
 
85
- # Intro to Cricket
86
  st.markdown("<h2 class='sub-header'>Cricket - The Gentleman’s Game 🏆</h2>", unsafe_allow_html=True)
87
  st.markdown(
88
- """
89
- <div class='text'>
90
- Cricket is not just a sport—it's a passion that unites nations. From the roar of the stadium to the precision of a last-ball thriller, cricket teaches discipline, strategy, and the spirit of sportsmanship.<br><br>
91
- Whether it's Test cricket’s grind, ODI’s balance, or T20’s thrill—each format brings unique excitement. Players like Sachin Tendulkar, MS Dhoni, and Virat Kohli have inspired generations across the globe.
92
- </div>
93
- """, unsafe_allow_html=True
94
  )
95
 
96
- # What is Cric Metrics?
97
  st.markdown("<h2 class='sub-header'>What is Cric Metrics? 📊</h2>", unsafe_allow_html=True)
98
  st.markdown(
99
- """
100
- <div class='text'>
101
- <b>Cric Metrics</b> is a smart analytics platform built using Python and Machine Learning. It helps cricket fans and analysts:
102
- <ul>
103
- <li>⚡ Compare players based on batting, bowling, and fielding metrics</li>
104
- <li>📈 Predict match outcomes and player performances</li>
105
- <li>📊 Visualize data using advanced graphs and charts</li>
106
- <li>💡 Make informed decisions using AI-powered insights</li>
107
- </ul>
108
- Whether you're a fan, coach, or data nerd—Cric Metrics is your playground for cricket analytics.
109
- </div>
110
- """, unsafe_allow_html=True
111
  )
112
 
113
- # Player Info Button
114
- st.markdown("<div class='button-container'>", unsafe_allow_html=True)
115
- if st.button("📊 Explore Player Information"):
116
- switch_page("pages/1player_information.py")
117
- st.markdown("</div>", unsafe_allow_html=True)
118
-
 
 
 
119
  # About Author
120
  st.markdown("<h2 class='sub-header'>About the Author 👨‍💻</h2>", unsafe_allow_html=True)
121
  st.markdown(
122
  """
123
  <div class='text'>
124
- <b>Sai Kalyan Satwik</b> is a seasoned cricket enthusiast and tech entrepreneur with over 10 years of experience in data science and software development. <br><br>
125
  His passion for cricket meets his technical expertise in this app, blending numbers with narratives for fans and analysts alike.
126
  </div>
127
  """,
128
  unsafe_allow_html=True
129
  )
130
 
 
 
 
 
131
  # Footer
132
- st.markdown("<div class='footer'>Built with ❤️ using Streamlit | © 2025 Cric Metrics</div>", unsafe_allow_html=True)
 
1
  import streamlit as st
2
+ import base64 # ✅ Add this
3
+
4
  from streamlit_extras.switch_page_button import switch_page
5
 
6
+ # Load and encode background image
7
  def get_base64_bg(image_path):
8
  with open(image_path, "rb") as img_file:
9
  encoded = base64.b64encode(img_file.read()).decode()
 
11
 
12
  background_img = get_base64_bg("background.jpg")
13
 
14
+ # Inject custom CSS with background
15
  st.markdown(
16
  f"""
17
  <style>
 
54
  border-radius: 10px;
55
  margin-bottom: 20px;
56
  }}
 
 
 
 
57
  .footer {{
58
  font-size: 14px;
59
  color: #333;
 
66
  unsafe_allow_html=True
67
  )
68
 
69
+ # App Header with Logo
 
 
 
70
  st.markdown(
71
  """
72
  <div class='header'>
 
77
  unsafe_allow_html=True
78
  )
79
 
80
+ # Sub-sections
81
  st.markdown("<h2 class='sub-header'>Cricket - The Gentleman’s Game 🏆</h2>", unsafe_allow_html=True)
82
  st.markdown(
83
+ "<p class='text'>"
84
+ "Cricket is one of the most popular sports worldwide, loved by millions. "
85
+ "It is played in multiple formats, including Tests, ODIs, and T20s. "
86
+ "With legendary players, thrilling rivalries, and unforgettable moments, cricket is more than a game—it's an emotion! 🏏"
87
+ "</p>",
88
+ unsafe_allow_html=True
89
  )
90
 
 
91
  st.markdown("<h2 class='sub-header'>What is Cric Metrics? 📊</h2>", unsafe_allow_html=True)
92
  st.markdown(
93
+ "<p class='text'>"
94
+ "Cric Metrics is an AI-powered cricket analytics platform. It offers player comparisons, performance analysis, "
95
+ "team stats, and match predictions. It empowers fans, analysts, and teams with smart, data-driven insights. 🤖📈"
96
+ "</p>",
97
+ unsafe_allow_html=True
 
 
 
 
 
 
 
98
  )
99
 
100
+ # Add more info if you'd like
101
+ st.markdown("<h2 class='sub-header'>More About Cric Metrics</h2>", unsafe_allow_html=True)
102
+ st.markdown(
103
+ "<p class='text'>"
104
+ "From grassroots cricket to international glory, Cric Metrics helps track form, fitness, and match-winning impact. "
105
+ "We leverage machine learning models and visual analytics to make cricket smarter and more fun! 🚀"
106
+ "</p>",
107
+ unsafe_allow_html=True
108
+ )
109
  # About Author
110
  st.markdown("<h2 class='sub-header'>About the Author 👨‍💻</h2>", unsafe_allow_html=True)
111
  st.markdown(
112
  """
113
  <div class='text'>
114
+ <b>Sai Kalyan Satwik</b> is a seasoned cricket enthusiast and tech entrepreneur having experience in data science and software development. <br><br>
115
  His passion for cricket meets his technical expertise in this app, blending numbers with narratives for fans and analysts alike.
116
  </div>
117
  """,
118
  unsafe_allow_html=True
119
  )
120
 
121
+ # Button
122
+ if st.button("📊 Player Information"):
123
+ st.switch_page("pages/1player_information.py")
124
+
125
  # Footer
126
+ st.markdown("<div class='footer'>Created with ❤️ by Sai Kalyan Satwik</div>", unsafe_allow_html=True)