shubham680 commited on
Commit
860a4d4
ยท
verified ยท
1 Parent(s): 1539832

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -23
app.py CHANGED
@@ -210,25 +210,6 @@ with st.container():
210
 
211
 
212
 
213
- # # --- Prediction Button & Result ---
214
- # result_placeholder = st.empty() # ๐Ÿ‘ˆ Reserve space near the button
215
-
216
- # if st.button("๐Ÿ” Predict", key="predict", help="Click to see your personality"):
217
- # prediction = knn.predict(final_input)[0]
218
- # proba = knn.predict_proba(final_input)[0]
219
- # label = prediction_labels.get(prediction, "โ“ Unknown")
220
- # confidence = proba[prediction] * 100
221
-
222
- # result_html = f"""
223
- # <div class='result-box'>
224
- # ๐Ÿ”ฎ <strong>Predicted Personality:</strong> {label}<br>
225
- # ๐Ÿ“Š <strong>Confidence:</strong> {confidence:.2f}%
226
- # </div>
227
- # """
228
- # result_placeholder.markdown(result_html, unsafe_allow_html=True)
229
-
230
-
231
-
232
  # --- Prediction Button & Result ---
233
  result_placeholder = st.empty() # ๐Ÿ‘ˆ Reserve space near the button
234
 
@@ -236,19 +217,38 @@ with st.container():
236
  prediction = knn.predict(final_input)[0]
237
  proba = knn.predict_proba(final_input)[0]
238
  label = prediction_labels.get(prediction, "โ“ Unknown")
 
239
 
240
  result_html = f"""
241
  <div class='result-box'>
242
- ๐Ÿ”ฎ <strong>Predicted Personality:</strong> {label}<br><br>
243
- ๐Ÿ“Š <strong>Probabilities:</strong><br>
244
- ๐ŸŒŸ Extrovert: {proba[0]*100:.2f}%<br>
245
- ๐ŸŒ™ Introvert: {proba[1]*100:.2f}%
246
  </div>
247
  """
248
  result_placeholder.markdown(result_html, unsafe_allow_html=True)
249
 
250
 
251
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
252
 
253
 
254
  # # --- Prediction Button & Result ---
 
210
 
211
 
212
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
213
  # --- Prediction Button & Result ---
214
  result_placeholder = st.empty() # ๐Ÿ‘ˆ Reserve space near the button
215
 
 
217
  prediction = knn.predict(final_input)[0]
218
  proba = knn.predict_proba(final_input)[0]
219
  label = prediction_labels.get(prediction, "โ“ Unknown")
220
+ confidence = proba[prediction] * 100
221
 
222
  result_html = f"""
223
  <div class='result-box'>
224
+ ๐Ÿ”ฎ <strong>Predicted Personality:</strong> {label}<br>
225
+ ๐Ÿ“Š <strong>Confidence:</strong> {confidence:.2f}%
 
 
226
  </div>
227
  """
228
  result_placeholder.markdown(result_html, unsafe_allow_html=True)
229
 
230
 
231
 
232
+ # # --- Prediction Button & Result ---
233
+ # result_placeholder = st.empty() # ๐Ÿ‘ˆ Reserve space near the button
234
+
235
+ # if st.button("๐Ÿ” Predict", key="predict", help="Click to see your personality"):
236
+ # prediction = knn.predict(final_input)[0]
237
+ # proba = knn.predict_proba(final_input)[0]
238
+ # label = prediction_labels.get(prediction, "โ“ Unknown")
239
+
240
+ # result_html = f"""
241
+ # <div class='result-box'>
242
+ # ๐Ÿ”ฎ <strong>Predicted Personality:</strong> {label}<br><br>
243
+ # ๐Ÿ“Š <strong>Probabilities:</strong><br>
244
+ # ๐ŸŒŸ Extrovert: {proba[0]*100:.2f}%<br>
245
+ # ๐ŸŒ™ Introvert: {proba[1]*100:.2f}%
246
+ # </div>
247
+ # """
248
+ # result_placeholder.markdown(result_html, unsafe_allow_html=True)
249
+
250
+
251
+
252
 
253
 
254
  # # --- Prediction Button & Result ---