Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -21,15 +21,8 @@ def predict_intent_to_stay(Engagement, WorkEnvironment, UpperLevelManagement, Re
|
|
| 21 |
# Perform prediction using the loaded model
|
| 22 |
prediction = loaded_model.predict_proba(input_data)[0][1] # Probability of staying
|
| 23 |
|
| 24 |
-
#
|
| 25 |
-
|
| 26 |
-
stay_percentage = prediction * 100
|
| 27 |
-
|
| 28 |
-
# Compare predicted value with actual value
|
| 29 |
-
actual_value = "Stay" if prediction >= 0.5 else "Leave"
|
| 30 |
-
|
| 31 |
-
# Return predicted value compared with actual value
|
| 32 |
-
return {"Predicted": actual_value, "Actual": actual_value}
|
| 33 |
|
| 34 |
# Create sliders for user input
|
| 35 |
engagement_slider = gr.Slider(minimum=1, maximum=5, value=3, label="Engagement")
|
|
@@ -52,7 +45,7 @@ interface = gr.Interface(
|
|
| 52 |
workload_slider,
|
| 53 |
learning_development_slider
|
| 54 |
],
|
| 55 |
-
outputs=
|
| 56 |
)
|
| 57 |
|
| 58 |
# Launch the interface
|
|
|
|
| 21 |
# Perform prediction using the loaded model
|
| 22 |
prediction = loaded_model.predict_proba(input_data)[0][1] # Probability of staying
|
| 23 |
|
| 24 |
+
# Return the predicted probability
|
| 25 |
+
return prediction
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
|
| 27 |
# Create sliders for user input
|
| 28 |
engagement_slider = gr.Slider(minimum=1, maximum=5, value=3, label="Engagement")
|
|
|
|
| 45 |
workload_slider,
|
| 46 |
learning_development_slider
|
| 47 |
],
|
| 48 |
+
outputs=gr.outputs.Label(num_top_classes=2)
|
| 49 |
)
|
| 50 |
|
| 51 |
# Launch the interface
|