Update app.py
Browse files
app.py
CHANGED
|
@@ -1,10 +1,13 @@
|
|
| 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 |
prediction = model.predict([[sl, sw, pl, pw]])
|
| 10 |
return classes[prediction[0]]
|
|
@@ -19,7 +22,8 @@ demo = gr.Interface(
|
|
| 19 |
],
|
| 20 |
outputs=gr.Textbox(label="Predicted Species"),
|
| 21 |
title="🌸 Iris Flower Classification AI",
|
| 22 |
-
description="Enter flower measurements to predict the Iris species
|
| 23 |
)
|
| 24 |
|
| 25 |
-
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import joblib
|
| 3 |
+
from spaces import GPU
|
| 4 |
|
| 5 |
+
# Load model
|
| 6 |
model = joblib.load("iris_model.pkl")
|
| 7 |
|
| 8 |
classes = ["Setosa", "Versicolor", "Virginica"]
|
| 9 |
|
| 10 |
+
@GPU
|
| 11 |
def predict_flower(sl, sw, pl, pw):
|
| 12 |
prediction = model.predict([[sl, sw, pl, pw]])
|
| 13 |
return classes[prediction[0]]
|
|
|
|
| 22 |
],
|
| 23 |
outputs=gr.Textbox(label="Predicted Species"),
|
| 24 |
title="🌸 Iris Flower Classification AI",
|
| 25 |
+
description="Enter flower measurements to predict the Iris species."
|
| 26 |
)
|
| 27 |
|
| 28 |
+
if __name__ == "__main__":
|
| 29 |
+
demo.launch()
|