Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import joblib
|
| 3 |
+
|
| 4 |
+
model = joblib.load("iris_model.pkl")
|
| 5 |
+
|
| 6 |
+
classes = ["Setosa", "Versicolor", "Virginica"]
|
| 7 |
+
|
| 8 |
+
def predict_flower(sl, sw, pl, pw):
|
| 9 |
+
pred = model.predict([[sl, sw, pl, pw]])
|
| 10 |
+
return classes[pred[0]]
|
| 11 |
+
|
| 12 |
+
demo = gr.Interface(
|
| 13 |
+
fn=predict_flower,
|
| 14 |
+
inputs=[
|
| 15 |
+
gr.Number(label="Sepal Length"),
|
| 16 |
+
gr.Number(label="Sepal Width"),
|
| 17 |
+
gr.Number(label="Petal Length"),
|
| 18 |
+
gr.Number(label="Petal Width")
|
| 19 |
+
],
|
| 20 |
+
outputs="text",
|
| 21 |
+
title="Iris Flower Classification AI",
|
| 22 |
+
description="Predict flower species using Machine Learning"
|
| 23 |
+
)
|
| 24 |
+
|
| 25 |
+
demo.launch()
|