Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from joblib import dump, load
|
3 |
+
import warnings
|
4 |
+
|
5 |
+
warnings.filterwarnings("ignore")
|
6 |
+
|
7 |
+
|
8 |
+
def process_data(marks, Family_relationship,Reason_school_choose,Home_school_trivel_time,Build_models,Play_outside,Solve_complex_problem,Daily_study_time,Tution_class,How_much_hours_sleep,Current_health_stutus,Past_class_failures,Take_higher_education):
|
9 |
+
userdata = [marks, Family_relationship,Reason_school_choose,Home_school_trivel_time,Build_models,Play_outside,Solve_complex_problem,Daily_study_time,Tution_class,How_much_hours_sleep,Current_health_stutus,Past_class_failures,Take_higher_education]
|
10 |
+
loaded_model = load('kashif_project.joblib')
|
11 |
+
predicted_grade = loaded_model.predict([userdata])
|
12 |
+
|
13 |
+
return predicted_grade[0]
|
14 |
+
|
15 |
+
iface = gr.Interface(
|
16 |
+
fn=process_data,
|
17 |
+
inputs=[
|
18 |
+
|
19 |
+
gr.inputs.Slider(minimum=200, maximum=550, default=(300, 550), label="Select Marks Range"),
|
20 |
+
gr.inputs.Radio(choices=[0,1, 2, 3, 4], label="Enter Your Family Relationship { 0: 'Bad', 1: 'Excelent' 2: 'Good' 3: 'Very Bad', 4: 'Very Good' } "),
|
21 |
+
gr.inputs.Radio(choices=[0,1, 2], label="Enter Reason for Choosing This School {0: 'Close To Home',1: 'Other', 2: 'School Reputation'}"),
|
22 |
+
gr.inputs.Radio(choices=[0,1, 2, 3], label="Enter Home To School Travel Time {0: 15min, 1: 25min, 2: 45min,3: 1hour}"),
|
23 |
+
gr.inputs.Radio(choices=[0,1, 2], label="Enter Do You Build Models {0: 'No', 1: 'Sometime', 2: 'Yes'}"),
|
24 |
+
gr.inputs.Radio(choices=[0,1, 2, 3], label="Enter Do You Play Outside { 0: 'No', 1: 'Sometime', 2: 'Yes', 3: Non } "),
|
25 |
+
gr.inputs.Radio(choices=[0,1, 2], label="Enter Do You Solve Complex Math Problems {0: 'No', 2: 'Yes', 1: 'Sometime'} "),
|
26 |
+
gr.inputs.Radio(choices=[0, 1, 2, 3], label="Enter Daily Study Time {1: '2hours', 2: '3-5hours', 3: '3hours', 0: '2-5h'} "),
|
27 |
+
gr.inputs.Radio(choices=[0,1, 2], label="Enter Do You Take Tuition classes { 1: 'No', 0: 'Yes'} "),
|
28 |
+
gr.inputs.Radio(choices=[ 0,1], label="Enter That How Much Hours Do You Sleep {1: '8hours', 0: '7hours'}"),
|
29 |
+
gr.inputs.Radio(choices=[0, 1, 2], label="Enter Your Current Health Status {0: 'Good', 1: 'Low', 2: 'Normal'}"),
|
30 |
+
gr.inputs.Radio(choices=[0,1, 2, 3, 4], label="Enter The Number of Past Class Failures {0: '1', 1: '2', 2: '3', 3: '>3',4: 'Never'} "),
|
31 |
+
gr.inputs.Radio(choices=[0,1, 2], label="Enter Do You Wants To Take Higher Education { 0: 'no',1: 'Yes', 2: 'Not sure'}"),
|
32 |
+
|
33 |
+
],
|
34 |
+
outputs=gr.outputs.Textbox(label="Result")
|
35 |
+
)
|
36 |
+
|
37 |
+
iface.launch()
|