Alimubariz124 commited on
Commit
f859059
·
verified ·
1 Parent(s): d3abf86

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -6
app.py CHANGED
@@ -246,15 +246,20 @@ label_mapping = {
246
  8: "Strangers"
247
  }
248
 
249
- # Make prediction
250
  if st.button('Submit'):
251
- prediction_numeric = model.predict(df)[0]
252
- prediction_numeric=prediction_numeric+1
 
 
 
 
 
253
 
254
  # Convert numpy array to int if it's a single value array
255
- if isinstance(prediction_numeric, np.ndarray) and prediction_numeric.size == 1:
256
- prediction_numeric = int(prediction_numeric)
257
- predicted_label = label_mapping.get(prediction_numeric, "Unknown")
258
 
259
  # Assuming 'predicted_label' is defined and holds the prediction result
260
 
 
246
  8: "Strangers"
247
  }
248
 
249
+ # Make prediction for demo purposes
250
  if st.button('Submit'):
251
+ # Choose a random key from label_mapping
252
+ random_key = random.choice(list(label_mapping.keys()))
253
+ random_label = label_mapping[random_key]
254
+
255
+ #if st.button('Submit'):
256
+ # prediction_numeric = model.predict(df)[0]
257
+ # prediction_numeric=prediction_numeric+1
258
 
259
  # Convert numpy array to int if it's a single value array
260
+ # if isinstance(prediction_numeric, np.ndarray) and prediction_numeric.size == 1:
261
+ # prediction_numeric = int(prediction_numeric)
262
+ # predicted_label = label_mapping.get(prediction_numeric, "Unknown")
263
 
264
  # Assuming 'predicted_label' is defined and holds the prediction result
265