Update app.py
Browse files
app.py
CHANGED
@@ -13,8 +13,8 @@ loaded_model = pickle.load(open("classroom_xgb.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 |
'Second_Sem_Grades':Second_Sem_Grades,'Previous_Qualification_Grade':Previous_Qualification_Grade,'First_Sem_Grades':First_Sem_Grades,
|
19 |
'Course':Course,'Second_Sem_Units_Approved':Second_Sem_Units_Approved,'Age_at_Enrollment':Age_at_Enrollment},
|
20 |
orient = 'index').transpose()
|
@@ -48,7 +48,6 @@ with gr.Blocks(title=title) as demo:
|
|
48 |
gr.Markdown("""---""")
|
49 |
with gr.Row():
|
50 |
with gr.Column():
|
51 |
-
Target = gr.Number(label="Dropout or Not", value=40)
|
52 |
Admission_Grade = gr.Slider(label="AdmissionGrade Score", minimum=0, maximum=1, value=1, step=1)
|
53 |
Second_Sem_Grades = gr.Slider(label="PreviousQualificationGrade Score", minimum=1, maximum=5, value=4, step=1)
|
54 |
Previous_Qualification_Grade = gr.Slider(label="CurricularUnits1stSemGrade Score", minimum=1, maximum=5, value=4, step=1)
|
@@ -64,12 +63,12 @@ with gr.Blocks(title=title) as demo:
|
|
64 |
|
65 |
submit_btn.click(
|
66 |
main_func,
|
67 |
-
[
|
68 |
[label,local_plot], api_name="Graduation_Predictor"
|
69 |
)
|
70 |
|
71 |
gr.Markdown("### Click on any of the examples below to see how it works:")
|
72 |
-
gr.Examples([
|
73 |
, [label,local_plot], main_func, cache_examples=True)
|
74 |
|
75 |
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(Admission_Grade, Second_Sem_Grades, Previous_Qualification_Grade, First_Sem_Grades, Course, Second_Sem_Units_Approved, Age_at_Enrollment):
|
17 |
+
new_row = pd.DataFrame.from_dict({'Admission_Grade':Admission_Grade,
|
18 |
'Second_Sem_Grades':Second_Sem_Grades,'Previous_Qualification_Grade':Previous_Qualification_Grade,'First_Sem_Grades':First_Sem_Grades,
|
19 |
'Course':Course,'Second_Sem_Units_Approved':Second_Sem_Units_Approved,'Age_at_Enrollment':Age_at_Enrollment},
|
20 |
orient = 'index').transpose()
|
|
|
48 |
gr.Markdown("""---""")
|
49 |
with gr.Row():
|
50 |
with gr.Column():
|
|
|
51 |
Admission_Grade = gr.Slider(label="AdmissionGrade Score", minimum=0, maximum=1, value=1, step=1)
|
52 |
Second_Sem_Grades = gr.Slider(label="PreviousQualificationGrade Score", minimum=1, maximum=5, value=4, step=1)
|
53 |
Previous_Qualification_Grade = gr.Slider(label="CurricularUnits1stSemGrade Score", minimum=1, maximum=5, value=4, step=1)
|
|
|
63 |
|
64 |
submit_btn.click(
|
65 |
main_func,
|
66 |
+
[Admission_Grade, Second_Sem_Grades, Previous_Qualification_Grade, First_Sem_Grades, Course, Second_Sem_Units_Approved, Age_at_Enrollment],
|
67 |
[label,local_plot], api_name="Graduation_Predictor"
|
68 |
)
|
69 |
|
70 |
gr.Markdown("### Click on any of the examples below to see how it works:")
|
71 |
+
gr.Examples([[119,13,122,12,3,0,18],[100,20,90,50,33,2,20]], [Admission_Grade, Second_Sem_Grades, Previous_Qualification_Grade, First_Sem_Grades, Course, Second_Sem_Units_Approved, Age_at_Enrollment]
|
72 |
, [label,local_plot], main_func, cache_examples=True)
|
73 |
|
74 |
demo.launch()
|