File size: 750 Bytes
8f7c658 349c656 8f7c658 349c656 8f7c658 349c656 8f7c658 349c656 8f7c658 349c656 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | import gradio as gr
import joblib
from spaces import GPU
# Load model
model = joblib.load("iris_model.pkl")
classes = ["Setosa", "Versicolor", "Virginica"]
@GPU
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."
)
if __name__ == "__main__":
demo.launch() |