Spaces:
Runtime error
Runtime error
| import gradio as gr | |
| import joblib | |
| model = joblib.load("iris_model.pkl") | |
| classes = ["Setosa", "Versicolor", "Virginica"] | |
| def predict_flower(sl, sw, pl, pw): | |
| pred = model.predict([[sl, sw, pl, pw]]) | |
| return classes[pred[0]] | |
| demo = gr.Interface( | |
| fn=predict_flower, | |
| inputs=[ | |
| gr.Number(label="Sepal Length"), | |
| gr.Number(label="Sepal Width"), | |
| gr.Number(label="Petal Length"), | |
| gr.Number(label="Petal Width") | |
| ], | |
| outputs="text", | |
| title="Iris Flower Classification AI", | |
| description="Predict flower species using Machine Learning" | |
| ) | |
| demo.launch() |