Spaces:
Sleeping
Sleeping
| 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() |