File size: 951 Bytes
d40e39e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | import gradio as gr
import pickle
import numpy as np
# Load model
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"
# Gradio UI
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() |