mrzaeem102's picture
Update app.py
349c656 verified
Raw History Blame Contribute Delete
750 Bytes
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()