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()