Update app.py
Browse files
app.py
CHANGED
|
@@ -213,28 +213,28 @@ with st.container():
|
|
| 213 |
|
| 214 |
st.markdown("</div>", unsafe_allow_html=True) # Close glass card
|
| 215 |
|
| 216 |
-
#--------- Prediction Button ---------
|
| 217 |
-
with st.container():
|
| 218 |
-
|
| 219 |
-
|
| 220 |
-
|
| 221 |
-
|
| 222 |
-
|
| 223 |
-
|
| 224 |
-
|
| 225 |
-
|
| 226 |
-
|
| 227 |
-
|
| 228 |
-
|
| 229 |
-
|
| 230 |
-
|
| 231 |
-
|
| 232 |
-
|
| 233 |
-
|
| 234 |
-
|
| 235 |
-
|
| 236 |
-
|
| 237 |
-
|
| 238 |
-
|
| 239 |
-
|
| 240 |
|
|
|
|
| 213 |
|
| 214 |
st.markdown("</div>", unsafe_allow_html=True) # Close glass card
|
| 215 |
|
| 216 |
+
# #--------- Prediction Button ---------
|
| 217 |
+
# with st.container():
|
| 218 |
+
# with st.container():
|
| 219 |
+
# predict_btn = st.container()
|
| 220 |
+
# with predict_btn:
|
| 221 |
+
# if st.button("๐ Predict", key="predict", help="Click to see your personality"):
|
| 222 |
+
# prediction = knn.predict(final_input)[0]
|
| 223 |
+
# label = prediction_labels.get(prediction, "โ Unknown")
|
| 224 |
+
# st.markdown(f"<div class='result-box'>๐ฎ Predicted Personality: <strong>{label}</strong></div>", unsafe_allow_html=True)
|
| 225 |
+
|
| 226 |
+
|
| 227 |
+
# --- Prediction Button & Result ---
|
| 228 |
+
result_placeholder = st.empty() # ๐ Reserve space near the button
|
| 229 |
+
|
| 230 |
+
if st.button("๐ Predict", key="predict", help="Click to see your personality"):
|
| 231 |
+
prediction = knn.predict(final_input)[0]
|
| 232 |
+
label = prediction_labels.get(prediction, "โ Unknown")
|
| 233 |
+
|
| 234 |
+
result_html = f"""
|
| 235 |
+
<div class='result-box'>
|
| 236 |
+
๐ฎ <strong>Predicted Personality:</strong> {label}
|
| 237 |
+
</div>
|
| 238 |
+
"""
|
| 239 |
+
result_placeholder.markdown(result_html, unsafe_allow_html=True) # ๐ result shows instantly in place
|
| 240 |
|