| import gradio as gr
|
| import pickle
|
| import numpy as np
|
|
|
|
|
| with open("model.pkl", "rb") as f:
|
| model = pickle.load(f)
|
|
|
| def predict_pass(study_hours, attendance, assignments_completed, previous_marks):
|
|
|
| data = np.array([[study_hours, attendance, assignments_completed, previous_marks]])
|
|
|
| prediction = model.predict(data)[0]
|
|
|
| if prediction == 1:
|
| return "โ
Student Will PASS"
|
| else:
|
| return "โ Student Will FAIL"
|
|
|
|
|
| interface = gr.Interface(
|
| fn=predict_pass,
|
| inputs=[
|
| gr.Number(label="Study Hours"),
|
| gr.Number(label="Attendance (%)"),
|
| gr.Number(label="Assignments Completed"),
|
| gr.Number(label="Previous Marks")
|
| ],
|
| outputs="text",
|
| title="๐ Student Pass/Fail Predictor",
|
| description="Predict whether a student will pass based on study hours, attendance, assignments, and previous marks."
|
| )
|
|
|
| interface.launch() |