Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| import joblib | |
| import numpy as np | |
| from huggingface_hub import hf_hub_download | |
| model_path = hf_hub_download( | |
| repo_id="24f2000010/iris-sklearn-model", | |
| filename="model.joblib" | |
| ) | |
| model = joblib.load(model_path) | |
| def predict(sl, sw, pl, pw): | |
| x = np.array([[sl, sw, pl, pw]]) | |
| pred = model.predict(x)[0] | |
| return ["setosa", "versicolor", "virginica"][pred] | |
| gr.Interface( | |
| fn=predict, | |
| 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 Classification (sklearn)" | |
| ).launch() | |