Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -130,10 +130,9 @@ Sarah
|
|
130 |
st.session_state.result_type = ""
|
131 |
st.rerun()
|
132 |
|
133 |
-
# Action buttons
|
134 |
col_analyze, col_clear = st.columns(2)
|
135 |
with col_analyze:
|
136 |
-
st.markdown('<div id="analyze-button">', unsafe_allow_html=True)
|
137 |
if st.button("Analyze Email", key="analyze"):
|
138 |
if email_body:
|
139 |
with st.spinner("Analyzing email..."):
|
@@ -143,16 +142,13 @@ Sarah
|
|
143 |
else:
|
144 |
st.session_state.result = "Please enter an email body or select a sample to analyze."
|
145 |
st.session_state.result_type = ""
|
146 |
-
st.markdown('</div>', unsafe_allow_html=True)
|
147 |
|
148 |
with col_clear:
|
149 |
-
st.markdown('<div id="clear-button">', unsafe_allow_html=True)
|
150 |
if st.button("Clear", key="clear"):
|
151 |
st.session_state.email_body = ""
|
152 |
st.session_state.result = ""
|
153 |
st.session_state.result_type = ""
|
154 |
st.rerun()
|
155 |
-
st.markdown('</div>', unsafe_allow_html=True)
|
156 |
|
157 |
# Display analysis result
|
158 |
if st.session_state.result:
|
@@ -165,76 +161,71 @@ Sarah
|
|
165 |
else:
|
166 |
st.write(st.session_state.result)
|
167 |
|
168 |
-
# Inject custom CSS
|
169 |
st.markdown("""
|
170 |
<style>
|
171 |
-
/* Style for
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
border:
|
178 |
-
border-radius:
|
179 |
-
width: 100% !important;
|
180 |
-
height: 50px !important;
|
181 |
-
box-sizing: border-box !important;
|
182 |
-
text-align: center !important;
|
183 |
-
margin: 0 !important;
|
184 |
}
|
185 |
-
|
186 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
187 |
}
|
188 |
-
|
189 |
-
|
190 |
-
#clear-button button {
|
191 |
-
background-color: #007BFF !important; /* Blue */
|
192 |
-
color: white !important;
|
193 |
-
font-size: 18px !important;
|
194 |
-
padding: 12px 24px !important;
|
195 |
-
border: none !important;
|
196 |
-
border-radius: 5px !important;
|
197 |
-
width: 100% !important;
|
198 |
-
height: 50px !important;
|
199 |
-
box-sizing: border-box !important;
|
200 |
-
text-align: center !important;
|
201 |
-
margin: 0 !important;
|
202 |
}
|
203 |
-
|
204 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
205 |
}
|
206 |
-
|
207 |
-
|
208 |
-
div[data-testid="stButton"] button:not([key="analyze"]):not([key="clear"]) {
|
209 |
-
font-size: 12px !important;
|
210 |
-
padding: 5px 10px !important;
|
211 |
-
background-color: #f0f0f0 !important; /* Light gray */
|
212 |
-
color: #333333 !important;
|
213 |
-
border: 1px solid #cccccc !important;
|
214 |
-
border-radius: 3px !important;
|
215 |
}
|
216 |
-
|
217 |
/* Result boxes */
|
218 |
.spam-result {
|
219 |
-
background-color: #ff3333
|
220 |
-
color: white
|
221 |
-
padding: 10px
|
222 |
-
border-radius: 5px
|
223 |
-
border: 1px solid #cc0000
|
224 |
}
|
225 |
.positive-result {
|
226 |
-
background-color: #ff3333
|
227 |
-
color: white
|
228 |
-
padding: 10px
|
229 |
-
border-radius: 5px
|
230 |
-
border: 1px solid #cc0000
|
231 |
}
|
232 |
.negative-result {
|
233 |
-
background-color: #006633
|
234 |
-
color: white
|
235 |
-
padding: 10px
|
236 |
-
border-radius: 5px
|
237 |
-
border: 1px solid #004d26
|
238 |
}
|
239 |
</style>
|
240 |
""", unsafe_allow_html=True)
|
|
|
130 |
st.session_state.result_type = ""
|
131 |
st.rerun()
|
132 |
|
133 |
+
# Action buttons
|
134 |
col_analyze, col_clear = st.columns(2)
|
135 |
with col_analyze:
|
|
|
136 |
if st.button("Analyze Email", key="analyze"):
|
137 |
if email_body:
|
138 |
with st.spinner("Analyzing email..."):
|
|
|
142 |
else:
|
143 |
st.session_state.result = "Please enter an email body or select a sample to analyze."
|
144 |
st.session_state.result_type = ""
|
|
|
145 |
|
146 |
with col_clear:
|
|
|
147 |
if st.button("Clear", key="clear"):
|
148 |
st.session_state.email_body = ""
|
149 |
st.session_state.result = ""
|
150 |
st.session_state.result_type = ""
|
151 |
st.rerun()
|
|
|
152 |
|
153 |
# Display analysis result
|
154 |
if st.session_state.result:
|
|
|
161 |
else:
|
162 |
st.write(st.session_state.result)
|
163 |
|
164 |
+
# Inject custom CSS without !important, based on your previous working code
|
165 |
st.markdown("""
|
166 |
<style>
|
167 |
+
/* Style for sample buttons (light grey) */
|
168 |
+
div.stButton > button[kind="secondary"]:not([key="clear"]) {
|
169 |
+
font-size: 12px;
|
170 |
+
padding: 5px 10px;
|
171 |
+
background-color: #f0f0f0;
|
172 |
+
color: #333333;
|
173 |
+
border: 1px solid #cccccc;
|
174 |
+
border-radius: 3px;
|
|
|
|
|
|
|
|
|
|
|
175 |
}
|
176 |
+
/* Analyze Email button (orange) */
|
177 |
+
div.stButton > button[key="analyze"] {
|
178 |
+
background-color: #FF5733;
|
179 |
+
color: white;
|
180 |
+
font-size: 18px;
|
181 |
+
padding: 12px 24px;
|
182 |
+
border: none;
|
183 |
+
border-radius: 5px;
|
184 |
+
width: 100%;
|
185 |
+
height: 50px;
|
186 |
+
box-sizing: border-box;
|
187 |
+
text-align: center;
|
188 |
}
|
189 |
+
div.stButton > button[key="analyze"]:hover {
|
190 |
+
background-color: #E74C3C;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
191 |
}
|
192 |
+
/* Clear button (blue) */
|
193 |
+
div.stButton > button[key="clear"] {
|
194 |
+
background-color: #007BFF;
|
195 |
+
color: white;
|
196 |
+
font-size: 18px;
|
197 |
+
padding: 12px 24px;
|
198 |
+
border: none;
|
199 |
+
border-radius: 5px;
|
200 |
+
width: 100%;
|
201 |
+
height: 50px;
|
202 |
+
box-sizing: border-box;
|
203 |
+
text-align: center;
|
204 |
}
|
205 |
+
div.stButton > button[key="clear"]:hover {
|
206 |
+
background-color: #0056b3;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
207 |
}
|
|
|
208 |
/* Result boxes */
|
209 |
.spam-result {
|
210 |
+
background-color: #ff3333;
|
211 |
+
color: white;
|
212 |
+
padding: 10px;
|
213 |
+
border-radius: 5px;
|
214 |
+
border: 1px solid #cc0000;
|
215 |
}
|
216 |
.positive-result {
|
217 |
+
background-color: #ff3333;
|
218 |
+
color: white;
|
219 |
+
padding: 10px;
|
220 |
+
border-radius: 5px;
|
221 |
+
border: 1px solid #cc0000;
|
222 |
}
|
223 |
.negative-result {
|
224 |
+
background-color: #006633;
|
225 |
+
color: white;
|
226 |
+
padding: 10px;
|
227 |
+
border-radius: 5px;
|
228 |
+
border: 1px solid #004d26;
|
229 |
}
|
230 |
</style>
|
231 |
""", unsafe_allow_html=True)
|