Download app.py from gracialy/datathon-dedrels: direct link, hf CLI and curl.
- Browser
- Download file 747 Bytes
-
https://huggingface.co/gracialy/datathon-dedrels/resolve/main/app.py
- Command line
-
hf download hf://gracialy/datathon-dedrels/app.py
-
curl -L -o app.py https://huggingface.co/gracialy/datathon-dedrels/resolve/main/app.py
747 Bytes
| import joblib | |
| import numpy as np | |
| import gradio as gr | |
| # Load your trained model | |
| model = joblib.load("model.joblib") | |
| # Define the prediction function | |
| def predict(input1, input2, input3): | |
| inputs = np.array([[input1, input2, input3]]) | |
| prediction = model.predict(inputs) | |
| return str(prediction[0]) # Convert to string for display | |
| # Build the Gradio interface | |
| interface = gr.Interface( | |
| fn=predict, | |
| inputs=[ | |
| gr.Number(label="Feature 1"), | |
| gr.Number(label="Feature 2"), | |
| gr.Number(label="Feature 3") | |
| ], | |
| outputs="text", | |
| title="Datathon Model Predictor", | |
| description="Enter 3 features to get prediction from the deployed model." | |
| ) | |
| # Run the app | |
| if __name__ == "__main__": | |
| interface.launch() | |