Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
|
| 3 |
+
def modelo(sepal_length, sepal_width, petal_length, petal_width):
|
| 4 |
+
species = ['Iris-Setosa', 'Iris-Versicolour', 'Iris-Virginica']
|
| 5 |
+
i = knn.predict([[sepal_length, sepal_width, petal_length, petal_width]])[0]
|
| 6 |
+
return species[i]
|
| 7 |
+
|
| 8 |
+
interfaz = gr.Interface(
|
| 9 |
+
fn=modelo,
|
| 10 |
+
inputs=[
|
| 11 |
+
gr.inputs.Slider(minimum=0.0, maximum=8.0, step=0.1, default=0.0, label='Sepal Length', optional=False),
|
| 12 |
+
gr.inputs.Slider(minimum=0.0, maximum=8.0, step=0.1, default=0.0, label='Sepal Width', optional=False),
|
| 13 |
+
gr.inputs.Slider(minimum=0.0, maximum=8.0, step=0.1, default=0.0, label='Petal Length', optional=False),
|
| 14 |
+
gr.inputs.Slider(minimum=0.0, maximum=8.0, step=0.1, default=0.0, label='Petal Width', optional=False)
|
| 15 |
+
],
|
| 16 |
+
outputs= gr.outputs.Textbox(type="email", label='Specie'),
|
| 17 |
+
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]],
|
| 18 |
+
title = 'Detector de especies de iris',
|
| 19 |
+
description = 'Este modelo est谩 desarrollado para la clasificaci贸n de flores de la especie Iris.',
|
| 20 |
+
article = 'Aplicaci贸n desarrollada con fines docentes en el curso Saturdays.ai',
|
| 21 |
+
theme = 'peach'
|
| 22 |
+
)
|
| 23 |
+
|
| 24 |
+
interfaz.launch()
|