Spaces:
Build error
Build error
VaAishvarR
commited on
Commit
·
1854f5d
1
Parent(s):
c2f5c14
Update app.py
Browse files
app.py
CHANGED
@@ -13,9 +13,9 @@ loaded_model = pickle.load(open("XGB_CLF_5Feature.pkl", 'rb'))
|
|
13 |
explainer = shap.Explainer(loaded_model) # PLEASE DO NOT CHANGE THIS.
|
14 |
|
15 |
# Create the main function for server
|
16 |
-
def main_func(
|
17 |
-
new_row = pd.DataFrame.from_dict({'
|
18 |
-
'EngagedAtWork':EngagedAtWork,'WorkEnvironment':WorkEnvironment,'
|
19 |
}, orient = 'index').transpose()
|
20 |
|
21 |
prob = loaded_model.predict_proba(new_row)
|
@@ -50,11 +50,11 @@ with gr.Blocks(title=title) as demo:
|
|
50 |
gr.Markdown("""---""")
|
51 |
with gr.Row():
|
52 |
with gr.Column():
|
53 |
-
|
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 |
-
|
58 |
submit_btn = gr.Button("Analyze")
|
59 |
with gr.Column(visible=True) as output_col:
|
60 |
label = gr.Label(label = "Predicted Label")
|
@@ -62,13 +62,13 @@ with gr.Blocks(title=title) as demo:
|
|
62 |
|
63 |
submit_btn.click(
|
64 |
main_func,
|
65 |
-
[
|
66 |
[label,local_plot], api_name="Employee_Turnover"
|
67 |
)
|
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 |
-
[
|
72 |
[label,local_plot], main_func, cache_examples=True)
|
73 |
|
74 |
demo.launch()
|
|
|
13 |
explainer = shap.Explainer(loaded_model) # PLEASE DO NOT CHANGE THIS.
|
14 |
|
15 |
# Create the main function for server
|
16 |
+
def main_func(JobSatisfaction,EmployeeWellBeing,EngagedAtWork,WorkEnvironment,Management):
|
17 |
+
new_row = pd.DataFrame.from_dict({'JobSatisfaction':JobSatisfaction,'EmployeeWellBeing':EmployeeWellBeing,
|
18 |
+
'EngagedAtWork':EngagedAtWork,'WorkEnvironment':WorkEnvironment,'Management':Management,
|
19 |
}, orient = 'index').transpose()
|
20 |
|
21 |
prob = loaded_model.predict_proba(new_row)
|
|
|
50 |
gr.Markdown("""---""")
|
51 |
with gr.Row():
|
52 |
with gr.Column():
|
53 |
+
JobSatisfaction = gr.Slider(label="Job Satisfaction 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 |
+
Management = gr.Slider(label="Management 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")
|
|
|
62 |
|
63 |
submit_btn.click(
|
64 |
main_func,
|
65 |
+
[JobSatisfaction,EmployeeWellBeing,EngagedAtWork,WorkEnvironment,Management],
|
66 |
[label,local_plot], api_name="Employee_Turnover"
|
67 |
)
|
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 |
+
[JobSatisfaction,EmployeeWellBeing,EngagedAtWork,WorkEnvironment,Management],
|
72 |
[label,local_plot], main_func, cache_examples=True)
|
73 |
|
74 |
demo.launch()
|