File size: 569 Bytes
ab2c6ab
 
d766334
ab2c6ab
 
42b9b41
ab2c6ab
 
 
d766334
 
 
4cbd56f
d766334
 
ab2c6ab
 
 
 
d766334
 
 
 
ab2c6ab
e4978f5
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
import joblib
import gradio as gr
import numpy as np

# Load model
model = joblib.load("model.pkl")

# Prediction function
def predict(val1, val2):
    try:
        data = np.array([[float(val1), float(val2)]])
        prediction = model.predict(data)
        return "User will select" if prediction[0] == 1 else "User will not select"
    except Exception as e:
        return f"Error: {str(e)}"

# UI
gr.Interface(
    fn=predict,
    inputs=[
        gr.Number(label="CGPA"),
        gr.Number(label="IQ")
    ],
    outputs="text"
).launch()