| | |
| | import gradio as gr |
| | import joblib |
| | import pandas as pd |
| | import numpy as np |
| | from keras.models import load_model |
| | |
| | cat_data_columns = joblib.load('Extracurricular Activities_encoder.joblib') |
| | |
| |
|
| | encoder=joblib.load('Extracurricular Activities_encoder.joblib') |
| | |
| | model = load_model('DNN_model.h5') |
| | |
| | scaler = joblib.load('scaler.joblib') |
| | |
| | def prediction_func(Hours_Studied,Previous_Scores, Extracurricular, Sleep_Hours, Sample): |
| | |
| | Extracurricular = encoder.transform([Extracurricular])[0] |
| | |
| | x_new = np.array([Hours_Studied,Previous_Scores,Extracurricular, Sleep_Hours, Sample]).reshape(1, -1) |
| | |
| | x_new = scaler.transform(x_new) |
| | |
| | y_pred = np.round(model.predict(x_new)) |
| | |
| | return y_pred[0][0] |
| |
|
| | |
| | inputs = [gr.Number(label="Hours Studied"), |
| | gr.Number(label="Previous Scores"), |
| | gr.Radio(choices=['Yes','No'] , label="Extracurricular Activities"), |
| | gr.Number( label="Sleep Hours"), |
| | gr.Number( label="Sample Question Paper"), |
| | |
| | ] |
| | |
| | outputs = gr.Textbox(label = 'Performance') |
| | |
| | Interface =gr.Interface(fn = prediction_func, |
| | inputs = inputs, |
| | outputs = outputs, |
| | title = 'Performance prediction ', theme='earneleh/paris') |
| | Interface.launch() |