File size: 833 Bytes
bedc31f
d7039db
 
bedc31f
d7039db
 
 
 
 
bedc31f
d7039db
 
 
 
 
 
 
bedc31f
d7039db
bedc31f
 
 
 
 
 
 
 
 
 
d7039db
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import gradio as gr
import pickle
import numpy as np

# Load the trained model
with open("clf.pkl", "rb") as f:
    clf = pickle.load(f)

# Define the prediction function
def predict(SupportiveGM, Merit, LearningDevelopment, WorkEnvironmente, Engagement, WellBeing, ChainScale):
    # Convert inputs into a NumPy array
    input_data = np.array([[SupportiveGM, Merit, LearningDevelopment, WorkEnvironmente, Engagement, WellBeing, ChainScale]])
    
    # Make prediction using the model
    prediction = clf.predict(input_data)

    return f"Predicted Turnover Probability: {prediction[0]}"

# Create the Gradio interface
iface = gr.Interface(
    fn=predict,
    inputs=["number"] * 7,
    outputs="text",
    title="Employee Turnover Prediction",
    api_name="/Employee_Turnover"
)

if __name__ == "__main__":
    iface.launch()