Spaces:
Sleeping
Sleeping
Download app.py from jackenmail/predictor: direct link, hf CLI and curl.
- Browser
- Download file 569 Bytes
-
https://huggingface.co/spaces/jackenmail/predictor/resolve/main/app.py
- Command line
-
hf download hf://spaces/jackenmail/predictor/app.py
-
curl -L -o app.py https://huggingface.co/spaces/jackenmail/predictor/resolve/main/app.py
569 Bytes
| 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() |