Mod3_Team5 / app.py
Mpodszus's picture
Update app.py
d7039db verified
raw
history blame
833 Bytes
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()