Download app.py from mrzaeem102/Data_Classification_project: direct link, hf CLI and curl.
- Browser
- Download file 701 Bytes
-
https://huggingface.co/spaces/mrzaeem102/Data_Classification_project/resolve/7c0f9b341dcd2d345ee5d0fd08fcc3113f3dff81/app.py
- Command line
-
hf download hf://spaces/mrzaeem102/Data_Classification_project@7c0f9b341dcd2d345ee5d0fd08fcc3113f3dff81/app.py
-
curl -L -o app.py https://huggingface.co/spaces/mrzaeem102/Data_Classification_project/resolve/7c0f9b341dcd2d345ee5d0fd08fcc3113f3dff81/app.py
701 Bytes
| import gradio as gr | |
| import joblib | |
| model = joblib.load("iris_model.pkl") | |
| classes = ["Setosa", "Versicolor", "Virginica"] | |
| def predict_flower(sl, sw, pl, pw): | |
| prediction = model.predict([[sl, sw, pl, pw]]) | |
| return classes[prediction[0]] | |
| demo = gr.Interface( | |
| fn=predict_flower, | |
| inputs=[ | |
| gr.Number(label="Sepal Length (cm)"), | |
| gr.Number(label="Sepal Width (cm)"), | |
| gr.Number(label="Petal Length (cm)"), | |
| gr.Number(label="Petal Width (cm)") | |
| ], | |
| outputs=gr.Textbox(label="Predicted Species"), | |
| title="🌸 Iris Flower Classification AI", | |
| description="Enter flower measurements to predict the Iris species using Machine Learning." | |
| ) | |
| demo.launch() |