kashoo's picture
Update app.py
d5c9bc6
import gradio as gr
from joblib import dump, load
import warnings
warnings.filterwarnings("ignore")
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):
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]
loaded_model = load('kashif_project.joblib')
predicted_grade = loaded_model.predict([userdata])
return predicted_grade[0]
iface = gr.Interface(
fn=process_data,
inputs=[
gr.inputs.Slider(minimum=200, maximum=550, default=(300, 550), label="Select Marks Range"),
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' } "),
gr.inputs.Radio(choices=[0,1, 2], label="Enter Reason for Choosing This School {0: 'Close To Home',1: 'Other', 2: 'School Reputation'}"),
gr.inputs.Radio(choices=[0,1, 2, 3], label="Enter Home To School Travel Time {0: 15min, 1: 25min, 2: 45min,3: 1hour}"),
gr.inputs.Radio(choices=[0,1, 2], label="Enter Do You Build Models {0: 'No', 1: 'Sometime', 2: 'Yes'}"),
gr.inputs.Radio(choices=[0,1, 2, 3], label="Enter Do You Play Outside { 0: 'No', 1: 'Sometime', 2: 'Yes', 3: Non } "),
gr.inputs.Radio(choices=[0,1, 2], label="Enter Do You Solve Complex Math Problems {0: 'No', 2: 'Yes', 1: 'Sometime'} "),
gr.inputs.Radio(choices=[0, 1, 2, 3], label="Enter Daily Study Time {1: '2hours', 2: '3-5hours', 3: '3hours', 0: '2-5h'} "),
gr.inputs.Radio(choices=[0,1, 2], label="Enter Do You Take Tuition classes { 1: 'No', 0: 'Yes'} "),
gr.inputs.Radio(choices=[ 0,1], label="Enter That How Much Hours Do You Sleep {1: '8hours', 0: '7hours'}"),
gr.inputs.Radio(choices=[0, 1, 2], label="Enter Your Current Health Status {0: 'Good', 1: 'Low', 2: 'Normal'}"),
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'} "),
gr.inputs.Radio(choices=[0,1, 2], label="Enter Do You Wants To Take Higher Education { 0: 'no',1: 'Yes', 2: 'Not sure'}"),
],
outputs=gr.outputs.Textbox(label="Result")
)
iface.launch()