ISOM5240GP4 commited on
Commit
7a0022c
·
verified ·
1 Parent(s): ddbfb5b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -11
app.py CHANGED
@@ -31,9 +31,10 @@ def analyze_email(email_body):
31
  return "positive", (f"This email is not spam (Confidence: {spam_confidence:.2f}).\n"
32
  f"Sentiment: {sentiment} (Confidence: {sentiment_confidence:.2f}). No follow-up needed.")
33
  else:
 
34
  return "negative", (f"This email is not spam (Confidence: {spam_confidence:.2f}).\n"
35
  f"Sentiment: {sentiment} (Confidence: {sentiment_confidence:.2f}).\n"
36
- "**Need to Follow-Up**: This email is not spam and has negative sentiment.")
37
 
38
  # Main application function
39
  def main():
@@ -104,29 +105,36 @@ Sarah
104
  border: 1px solid #cccccc;
105
  border-radius: 3px;
106
  }
107
- /* Analyze Email button (larger, orange) */
108
- div.stButton > button[kind="primary"] {
109
  background-color: #FF5733;
110
  color: white;
111
  font-size: 18px;
112
  padding: 12px 24px;
113
  border: none;
114
  border-radius: 5px;
115
- margin-right: 10px;
 
 
 
116
  }
117
- div.stButton > button[kind="primary"]:hover {
118
  background-color: #E74C3C;
119
  }
120
- /* Clear button (aligned with Analyze, gray) */
121
- div.stButton > button[kind="secondary"][key="clear"] {
122
  background-color: #d3d3d3;
123
  color: #333333;
124
  font-size: 18px;
125
  padding: 12px 24px;
126
  border: none;
127
  border-radius: 5px;
 
 
 
 
128
  }
129
- div.stButton > button[kind="secondary"][key="clear"]:hover {
130
  background-color: #b0b0b0;
131
  }
132
  /* Result boxes */
@@ -178,7 +186,8 @@ Sarah
178
  # Action buttons layout (Analyze and Clear)
179
  col_analyze, col_clear = st.columns(2)
180
  with col_analyze:
181
- if st.button("Analyze Email", key="analyze", type="primary"):
 
182
  if email_body:
183
  with st.spinner("Analyzing email..."):
184
  result_type, result = analyze_email(email_body)
@@ -207,5 +216,4 @@ Sarah
207
 
208
  # Run the app
209
  if __name__ == "__main__":
210
- main()
211
-
 
31
  return "positive", (f"This email is not spam (Confidence: {spam_confidence:.2f}).\n"
32
  f"Sentiment: {sentiment} (Confidence: {sentiment_confidence:.2f}). No follow-up needed.")
33
  else:
34
+ # Using HTML <b> tags to ensure bolding
35
  return "negative", (f"This email is not spam (Confidence: {spam_confidence:.2f}).\n"
36
  f"Sentiment: {sentiment} (Confidence: {sentiment_confidence:.2f}).\n"
37
+ "<b>Need to Follow-Up</b>: This email is not spam and has negative sentiment.")
38
 
39
  # Main application function
40
  def main():
 
105
  border: 1px solid #cccccc;
106
  border-radius: 3px;
107
  }
108
+ /* Analyze Email button (orange) */
109
+ div.stButton > button[key="analyze"] {
110
  background-color: #FF5733;
111
  color: white;
112
  font-size: 18px;
113
  padding: 12px 24px;
114
  border: none;
115
  border-radius: 5px;
116
+ width: 100%;
117
+ height: 50px; /* Fixed height for consistency */
118
+ box-sizing: border-box;
119
+ text-align: center;
120
  }
121
+ div.stButton > button[key="analyze"]:hover {
122
  background-color: #E74C3C;
123
  }
124
+ /* Clear button (gray, aligned with Analyze) */
125
+ div.stButton > button[key="clear"] {
126
  background-color: #d3d3d3;
127
  color: #333333;
128
  font-size: 18px;
129
  padding: 12px 24px;
130
  border: none;
131
  border-radius: 5px;
132
+ width: 100%;
133
+ height: 50px; /* Fixed height for consistency */
134
+ box-sizing: border-box;
135
+ text-align: center;
136
  }
137
+ div.stButton > button[key="clear"]:hover {
138
  background-color: #b0b0b0;
139
  }
140
  /* Result boxes */
 
186
  # Action buttons layout (Analyze and Clear)
187
  col_analyze, col_clear = st.columns(2)
188
  with col_analyze:
189
+ # Removed type="primary" to rely on custom CSS
190
+ if st.button("Analyze Email", key="analyze"):
191
  if email_body:
192
  with st.spinner("Analyzing email..."):
193
  result_type, result = analyze_email(email_body)
 
216
 
217
  # Run the app
218
  if __name__ == "__main__":
219
+ main()