AshenR commited on
Commit
02a7592
Β·
verified Β·
1 Parent(s): 5651616

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +41 -18
app.py CHANGED
@@ -194,47 +194,70 @@ import os
194
 
195
  # Styling and Configuration
196
  st.set_page_config(
197
- page_title="Sentiment Insight",
198
  page_icon="🧠",
199
  layout="wide",
200
  initial_sidebar_state="expanded"
201
  )
202
 
203
- # Custom CSS for enhanced styling
204
  st.markdown("""
205
  <style>
 
206
  .stApp {
207
- background-color: #f0f2f6;
 
208
  }
 
 
 
 
 
 
 
 
209
  .stTextArea > div > div > textarea {
210
- background-color: white;
211
- border: 2px solid #3498db;
 
212
  border-radius: 10px;
213
  padding: 10px;
214
  }
 
 
215
  .stButton > button {
216
- background-color: #3498db;
217
  color: white;
218
  border-radius: 10px;
219
  border: none;
220
  padding: 10px 20px;
221
  transition: all 0.3s ease;
222
  }
 
223
  .stButton > button:hover {
224
- background-color: #2980b9;
225
  transform: scale(1.05);
226
  }
 
 
227
  .result-card {
228
- background-color: white;
229
  border-radius: 10px;
230
  padding: 15px;
231
  margin-bottom: 10px;
232
- box-shadow: 0 4px 6px rgba(0,0,0,0.1);
233
  transition: all 0.3s ease;
 
234
  }
 
235
  .result-card:hover {
236
  transform: translateY(-5px);
237
- box-shadow: 0 6px 8px rgba(0,0,0,0.15);
 
 
 
 
 
238
  }
239
  </style>
240
  """, unsafe_allow_html=True)
@@ -246,11 +269,11 @@ SENTIMENT_EMOJIS = {
246
  'Positive': '😊' # Smiling face for positive sentiment
247
  }
248
 
249
- # Sentiment Color Coding
250
  SENTIMENT_COLORS = {
251
- 'Negative': '#e74c3c', # Red for negative
252
- 'Neutral': '#95a5a6', # Gray for neutral
253
- 'Positive': '#2ecc71' # Green for positive
254
  }
255
 
256
  # Sentiment Prediction Model (Same as previous implementation)
@@ -388,7 +411,7 @@ def main():
388
  # Title with gradient and centered
389
  st.markdown("""
390
  <h1 style="text-align: center;
391
- background: linear-gradient(to right, #3498db, #2c3e50);
392
  -webkit-background-clip: text;
393
  -webkit-text-fill-color: transparent;
394
  font-size: 3rem;">
@@ -438,15 +461,15 @@ def main():
438
 
439
  # Custom styled result card
440
  st.markdown(f"""
441
- <div class="result-card" style="border-left: 5px solid {SENTIMENT_COLORS.get(sentiment, '#3498db')};">
442
  <h4 style="margin-bottom: 10px;">
443
- <span style="color: {SENTIMENT_COLORS.get(sentiment, '#3498db')};">
444
  {clean_aspect}
445
  </span>
446
  </h4>
447
  <p>
448
  <strong>Sentiment:</strong>
449
- <span style="color: {SENTIMENT_COLORS.get(sentiment, '#3498db')};">
450
  {sentiment} {SENTIMENT_EMOJIS.get(sentiment, '')}
451
  </span>
452
  </p>
 
194
 
195
  # Styling and Configuration
196
  st.set_page_config(
197
+ page_title="Sentiment Prediction with Aspects",
198
  page_icon="🧠",
199
  layout="wide",
200
  initial_sidebar_state="expanded"
201
  )
202
 
203
+ # Custom CSS for enhanced dark mode styling
204
  st.markdown("""
205
  <style>
206
+ /* Dark Mode Base Styling */
207
  .stApp {
208
+ background-color: #121212;
209
+ color: #e0e0e0;
210
  }
211
+
212
+ /* Sidebar Styling */
213
+ .css-1aumxhk {
214
+ background-color: #1e1e1e;
215
+ color: #e0e0e0;
216
+ }
217
+
218
+ /* Text Area Styling */
219
  .stTextArea > div > div > textarea {
220
+ background-color: #1e1e1e;
221
+ color: #e0e0e0;
222
+ border: 2px solid #4a4a4a;
223
  border-radius: 10px;
224
  padding: 10px;
225
  }
226
+
227
+ /* Button Styling */
228
  .stButton > button {
229
+ background-color: #2196f3;
230
  color: white;
231
  border-radius: 10px;
232
  border: none;
233
  padding: 10px 20px;
234
  transition: all 0.3s ease;
235
  }
236
+
237
  .stButton > button:hover {
238
+ background-color: #1976d2;
239
  transform: scale(1.05);
240
  }
241
+
242
+ /* Result Card Styling */
243
  .result-card {
244
+ background-color: #1e1e1e;
245
  border-radius: 10px;
246
  padding: 15px;
247
  margin-bottom: 10px;
248
+ box-shadow: 0 4px 6px rgba(255,255,255,0.1);
249
  transition: all 0.3s ease;
250
+ color: #e0e0e0;
251
  }
252
+
253
  .result-card:hover {
254
  transform: translateY(-5px);
255
+ box-shadow: 0 6px 8px rgba(255,255,255,0.15);
256
+ }
257
+
258
+ /* Headings and Text */
259
+ h1, h2, h3, h4, p, div, span {
260
+ color: #e0e0e0 !important;
261
  }
262
  </style>
263
  """, unsafe_allow_html=True)
 
269
  'Positive': '😊' # Smiling face for positive sentiment
270
  }
271
 
272
+ # Sentiment Color Coding (Updated for better visibility in dark mode)
273
  SENTIMENT_COLORS = {
274
+ 'Negative': '#ff6b6b', # Bright red for negative
275
+ 'Neutral': '#4a4a4a', # Gray for neutral
276
+ 'Positive': '#4caf50' # Bright green for positive
277
  }
278
 
279
  # Sentiment Prediction Model (Same as previous implementation)
 
411
  # Title with gradient and centered
412
  st.markdown("""
413
  <h1 style="text-align: center;
414
+ background: linear-gradient(to right, #2196f3, #1976d2);
415
  -webkit-background-clip: text;
416
  -webkit-text-fill-color: transparent;
417
  font-size: 3rem;">
 
461
 
462
  # Custom styled result card
463
  st.markdown(f"""
464
+ <div class="result-card" style="border-left: 5px solid {SENTIMENT_COLORS.get(sentiment, '#2196f3')};">
465
  <h4 style="margin-bottom: 10px;">
466
+ <span style="color: {SENTIMENT_COLORS.get(sentiment, '#2196f3')};">
467
  {clean_aspect}
468
  </span>
469
  </h4>
470
  <p>
471
  <strong>Sentiment:</strong>
472
+ <span style="color: {SENTIMENT_COLORS.get(sentiment, '#2196f3')};">
473
  {sentiment} {SENTIMENT_EMOJIS.get(sentiment, '')}
474
  </span>
475
  </p>