Adityaganesh commited on
Commit
1118b28
Β·
verified Β·
1 Parent(s): 89216a0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -14
app.py CHANGED
@@ -92,16 +92,6 @@ def predict_category(text):
92
  category_idx = np.argmax(prediction, axis=1)[0]
93
  return label_encoder.inverse_transform([category_idx])[0]
94
 
95
- # βœ… Category Color Mapping
96
- category_colors = {
97
- "Sports": "#27ae60", # Green
98
- "Politics": "#2980b9", # Blue
99
- "Entertainment": "#8e44ad", # Purple
100
- "Technology": "#e67e22", # Orange
101
- "Business": "#c0392b", # Red
102
- "Default": "#ffffff" # White
103
- }
104
-
105
  # βœ… Streamlit UI Design
106
  st.markdown("""
107
  <style>
@@ -123,6 +113,7 @@ st.markdown("""
123
  padding: 10px;
124
  }
125
  .result-box {
 
126
  padding: 25px;
127
  border-radius: 12px;
128
  text-align: center;
@@ -131,12 +122,15 @@ st.markdown("""
131
  font-weight: 900;
132
  text-shadow: 3px 3px 10px rgba(0, 0, 0, 0.5);
133
  }
 
 
 
134
  </style>
135
  """, unsafe_allow_html=True)
136
 
137
  # βœ… Page Title
138
  st.markdown("<div class='title'>🧠 Intelligent News Classifier</div>", unsafe_allow_html=True)
139
- st.markdown("<div class='subtitle'>Find out what type of news you're reading!.</div>", unsafe_allow_html=True)
140
 
141
  # βœ… User Input
142
  user_input = st.text_area("Enter text here:", height=150, placeholder="Type your news text here...")
@@ -145,11 +139,10 @@ user_input = st.text_area("Enter text here:", height=150, placeholder="Type your
145
  if st.button("Analyze 🧐"):
146
  if user_input.strip():
147
  category = predict_category(user_input)
148
- color = category_colors.get(category, category_colors["Default"])
149
  st.markdown(
150
  f"""
151
- <div class='result-box' style='color: {color};'>
152
- πŸ—‚οΈ Predicted Category: <strong>{category}</strong>
153
  </div>
154
  """,
155
  unsafe_allow_html=True
 
92
  category_idx = np.argmax(prediction, axis=1)[0]
93
  return label_encoder.inverse_transform([category_idx])[0]
94
 
 
 
 
 
 
 
 
 
 
 
95
  # βœ… Streamlit UI Design
96
  st.markdown("""
97
  <style>
 
113
  padding: 10px;
114
  }
115
  .result-box {
116
+ background-color: #000000; /* Black background */
117
  padding: 25px;
118
  border-radius: 12px;
119
  text-align: center;
 
122
  font-weight: 900;
123
  text-shadow: 3px 3px 10px rgba(0, 0, 0, 0.5);
124
  }
125
+ .result-text {
126
+ color: #27ae60; /* Green text */
127
+ }
128
  </style>
129
  """, unsafe_allow_html=True)
130
 
131
  # βœ… Page Title
132
  st.markdown("<div class='title'>🧠 Intelligent News Classifier</div>", unsafe_allow_html=True)
133
+ st.markdown("<div class='subtitle'>Find out what type of news you're reading!</div>", unsafe_allow_html=True)
134
 
135
  # βœ… User Input
136
  user_input = st.text_area("Enter text here:", height=150, placeholder="Type your news text here...")
 
139
  if st.button("Analyze 🧐"):
140
  if user_input.strip():
141
  category = predict_category(user_input)
 
142
  st.markdown(
143
  f"""
144
+ <div class='result-box'>
145
+ <span class='result-text'>πŸ—‚οΈ Predicted Category: <strong>{category}</strong></span>
146
  </div>
147
  """,
148
  unsafe_allow_html=True