Download app.py from Sayiqa/iris_new: direct link, hf CLI and curl.
- Browser
- Download file 773 Bytes
-
https://huggingface.co/spaces/Sayiqa/iris_new/resolve/main/app.py
- Command line
-
hf download hf://spaces/Sayiqa/iris_new/app.py
-
curl -L -o app.py https://huggingface.co/spaces/Sayiqa/iris_new/resolve/main/app.py
773 Bytes
| import pickle | |
| import gradio as gr | |
| def make_predicition(sepal_length,sepal_width,petal_length,petal_width): | |
| with open("model_iris.pkl","rb") as f: | |
| clf=pickle.load(f) | |
| preds=clf.predict([[sepal_length,sepal_width,petal_length,petal_width]]) | |
| if preds==0: | |
| return "IRIS-SETOSA" | |
| elif preds==1: | |
| return "IRIS-VERSICOLOR" | |
| else: | |
| return "IRIS-VIRGINICA" | |
| #CREATE the input component for Gradio since we are expecting 4 inputs | |
| sep_len=gr.Number(label="SEPAL LENGTH") | |
| sep_wid=gr.Number(label="SEPAL WIDTH") | |
| pet_len=gr.Number(label="PETAL LENGTH") | |
| pet_wid=gr.Number(label="PETAL WIDTH") | |
| #create the output | |
| output=gr.Textbox() | |
| app=gr.Interface(fn=make_predicition,inputs=[sep_len,sep_wid,pet_len,pet_wid],outputs=output) | |
| app.launch() |