manisha56 commited on
Commit
91be5e6
·
verified ·
1 Parent(s): ad92db5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -17,7 +17,7 @@ loaded_model = pickle.load(open("h47_xgb.pkl", 'rb'))
17
  explainer = shap.Explainer(loaded_model)
18
 
19
  #Creating employee profiles for Mr.Bean and Tom Hanks
20
- employee_profiles = {
21
  "Mr.Bean - At Risk/Medium Risk 🟥⚠️": [4.2, 3.6, 3.4, 3.5, 3.7, 3.9],
22
  "Tom Hanks - Happy 🟢": [5.0, 4.8, 4.7, 4.8, 4.9, 4.9],
23
  "Default": [3, 3, 3, 3, 3, 3]
@@ -51,8 +51,8 @@ def main_func(Engage2, Voice, Merit, Workload, WellBeing, SupportiveGM,
51
 
52
  # Updates the sliders so that they show the values of each of the profiles
53
  def update_sliders(profile):
54
- if profile in employee_profiles:
55
- return employee_profiles[profile]
56
  return [3,3,3,3,3,3]
57
 
58
  # Create the UI
@@ -96,4 +96,7 @@ with gr.Blocks(theme = gt.Soft()) as demo:
96
 
97
  profile_dropdown.change(update_sliders, inputs=[profile_dropdown], outputs=[Engage2, Voice, Merit, Workload, WellBeing, SupportiveGM])
98
 
99
- demo.launch()
 
 
 
 
17
  explainer = shap.Explainer(loaded_model)
18
 
19
  #Creating employee profiles for Mr.Bean and Tom Hanks
20
+ employee_selection = {
21
  "Mr.Bean - At Risk/Medium Risk 🟥⚠️": [4.2, 3.6, 3.4, 3.5, 3.7, 3.9],
22
  "Tom Hanks - Happy 🟢": [5.0, 4.8, 4.7, 4.8, 4.9, 4.9],
23
  "Default": [3, 3, 3, 3, 3, 3]
 
51
 
52
  # Updates the sliders so that they show the values of each of the profiles
53
  def update_sliders(profile):
54
+ if profile in employee_selection:
55
+ return employee_selection [profile]
56
  return [3,3,3,3,3,3]
57
 
58
  # Create the UI
 
96
 
97
  profile_dropdown.change(update_sliders, inputs=[profile_dropdown], outputs=[Engage2, Voice, Merit, Workload, WellBeing, SupportiveGM])
98
 
99
+ demo.launch()
100
+
101
+
102
+