VaAishvarR commited on
Commit
7d57cde
1 Parent(s): b4a8352

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -9
app.py CHANGED
@@ -7,7 +7,7 @@ import numpy as np
7
  import matplotlib.pyplot as plt
8
 
9
  # load the model from disk
10
- loaded_model = pickle.load(open("h22_xgb.pkl", 'rb'))
11
 
12
  # Setup SHAP
13
  explainer = shap.Explainer(loaded_model) # PLEASE DO NOT CHANGE THIS.
@@ -34,7 +34,7 @@ def main_func(ValueDiversity,AdequateResources,Voice,GrowthAdvancement,Workload,
34
  # Create the UI
35
  title = "**Employee Turnover Predictor & Interpreter** 🪐"
36
  description1 = """
37
- This app takes six inputs about employees' satisfaction with different aspects of their work (such as work-life balance, ...) and predicts whether the employee intends to stay with the employer or leave. There are two outputs from the app: 1- the predicted probability of stay or leave, 2- Shapley's force-plot which visualizes the extent to which each factor impacts the stay/ leave prediction.
38
  """
39
 
40
  description2 = """
@@ -50,12 +50,11 @@ with gr.Blocks(title=title) as demo:
50
  gr.Markdown("""---""")
51
  with gr.Row():
52
  with gr.Column():
53
- ValueDiversity = gr.Slider(label="ValueDiversity Score", minimum=1, maximum=5, value=4, step=.1)
54
- AdequateResources = gr.Slider(label="AdequateResources Score", minimum=1, maximum=5, value=4, step=.1)
55
- Voice = gr.Slider(label="Voice Score", minimum=1, maximum=5, value=4, step=.1)
56
- GrowthAdvancement = gr.Slider(label="GrowthAdvancement Score", minimum=1, maximum=5, value=4, step=.1)
57
- Workload = gr.Slider(label="Workload Score", minimum=1, maximum=5, value=4, step=.1)
58
- WorkLifeBalance = gr.Slider(label="WorkLifeBalance Score", minimum=1, maximum=5, value=4, step=.1)
59
  submit_btn = gr.Button("Analyze")
60
  with gr.Column(visible=True) as output_col:
61
  label = gr.Label(label = "Predicted Label")
@@ -69,7 +68,7 @@ with gr.Blocks(title=title) as demo:
69
 
70
  gr.Markdown("### Click on any of the examples below to see how it works:")
71
  gr.Examples([[4,4,4,4,5,5], [5,4,5,4,4,4]],
72
- [ValueDiversity,AdequateResources,Voice,GrowthAdvancement,Workload,WorkLifeBalance],
73
  [label,local_plot], main_func, cache_examples=True)
74
 
75
  demo.launch()
 
7
  import matplotlib.pyplot as plt
8
 
9
  # load the model from disk
10
+ loaded_model = pickle.load(open("XGBclf_v0.2.sav", 'rb'))
11
 
12
  # Setup SHAP
13
  explainer = shap.Explainer(loaded_model) # PLEASE DO NOT CHANGE THIS.
 
34
  # Create the UI
35
  title = "**Employee Turnover Predictor & Interpreter** 🪐"
36
  description1 = """
37
+ This app takes five inputs about employees' satisfaction with different aspects of their work (such as job satisfaction, ...) and predicts whether the employee intends to stay with the employer or leave. There are two outputs from the app: 1- the predicted probability of stay or leave, 2- Shapley's force-plot which visualizes the extent to which each factor impacts the stay/ leave prediction.
38
  """
39
 
40
  description2 = """
 
50
  gr.Markdown("""---""")
51
  with gr.Row():
52
  with gr.Column():
53
+ Management = gr.Slider(label="Management Score", minimum=1, maximum=5, value=4, step=.1)
54
+ EmployeeWellBeing = gr.Slider(label="Employee Well Being Score", minimum=1, maximum=5, value=4, step=.1)
55
+ EngagedAtWork = gr.Slider(label="Work Engagement Score", minimum=1, maximum=5, value=4, step=.1)
56
+ WorkEnvironment = gr.Slider(label="Work Environment Score", minimum=1, maximum=5, value=4, step=.1)
57
+ JobSatisfaction = gr.Slider(label="Job Satisfaction Score", minimum=1, maximum=5, value=4, step=.1)
 
58
  submit_btn = gr.Button("Analyze")
59
  with gr.Column(visible=True) as output_col:
60
  label = gr.Label(label = "Predicted Label")
 
68
 
69
  gr.Markdown("### Click on any of the examples below to see how it works:")
70
  gr.Examples([[4,4,4,4,5,5], [5,4,5,4,4,4]],
71
+ [Management,EmployeeWellBeing,EngagedAtWork,WorkEnvironment,JobSatisfaction],
72
  [label,local_plot], main_func, cache_examples=True)
73
 
74
  demo.launch()