Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| import pickle | |
| with open('modelo.pkl', 'rb') as file: | |
| knn = pickle.load(file) | |
| def modelo(sepal_length, sepal_width, petal_length, petal_width): | |
| species = ['Iris-Setosa', 'Iris-Versicolour', 'Iris-Virginica'] | |
| i = knn.predict([[sepal_length, sepal_width, petal_length, petal_width]])[0] | |
| return species[i] | |
| interfaz = gr.Interface( | |
| fn=modelo, | |
| inputs=[ | |
| gr.inputs.Slider(minimum=0.0, maximum=8.0, step=0.1, default=0.0, label='Sepal Length', optional=False), | |
| gr.inputs.Slider(minimum=0.0, maximum=8.0, step=0.1, default=0.0, label='Sepal Width', optional=False), | |
| gr.inputs.Slider(minimum=0.0, maximum=8.0, step=0.1, default=0.0, label='Petal Length', optional=False), | |
| gr.inputs.Slider(minimum=0.0, maximum=8.0, step=0.1, default=0.0, label='Petal Width', optional=False) | |
| ], | |
| outputs= gr.outputs.Textbox(type="email", label='Specie'), | |
| examples= [[6.7, 3.0, 5.2, 2.3], [4.7, 3.2, 1.3, 0.2], [5.0, 3.6, 1.4, 0.2]], | |
| title = 'Detector de especies de iris', | |
| description = 'Este modelo est谩 desarrollado para la clasificaci贸n de flores de la especie Iris.', | |
| article = 'Aplicaci贸n desarrollada con fines docentes en el curso Saturdays.ai', | |
| theme = 'peach' | |
| ) | |
| interfaz.launch() |