Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,9 +1,22 @@
|
|
1 |
import gradio as gr
|
|
|
|
|
2 |
|
|
|
|
|
|
|
|
|
|
|
3 |
def predict(SupportiveGM, Merit, LearningDevelopment, WorkEnvironmente, Engagement, WellBeing, ChainScale):
|
4 |
-
#
|
5 |
-
|
|
|
|
|
|
|
|
|
|
|
6 |
|
|
|
7 |
iface = gr.Interface(
|
8 |
fn=predict,
|
9 |
inputs=["number"] * 7,
|
@@ -14,3 +27,4 @@ iface = gr.Interface(
|
|
14 |
|
15 |
if __name__ == "__main__":
|
16 |
iface.launch()
|
|
|
|
1 |
import gradio as gr
|
2 |
+
import pickle
|
3 |
+
import numpy as np
|
4 |
|
5 |
+
# Load the trained model
|
6 |
+
with open("clf.pkl", "rb") as f:
|
7 |
+
clf = pickle.load(f)
|
8 |
+
|
9 |
+
# Define the prediction function
|
10 |
def predict(SupportiveGM, Merit, LearningDevelopment, WorkEnvironmente, Engagement, WellBeing, ChainScale):
|
11 |
+
# Convert inputs into a NumPy array
|
12 |
+
input_data = np.array([[SupportiveGM, Merit, LearningDevelopment, WorkEnvironmente, Engagement, WellBeing, ChainScale]])
|
13 |
+
|
14 |
+
# Make prediction using the model
|
15 |
+
prediction = clf.predict(input_data)
|
16 |
+
|
17 |
+
return f"Predicted Turnover Probability: {prediction[0]}"
|
18 |
|
19 |
+
# Create the Gradio interface
|
20 |
iface = gr.Interface(
|
21 |
fn=predict,
|
22 |
inputs=["number"] * 7,
|
|
|
27 |
|
28 |
if __name__ == "__main__":
|
29 |
iface.launch()
|
30 |
+
|