Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,17 +1,10 @@
|
|
| 1 |
-
|
| 2 |
-
from pydantic import BaseModel
|
| 3 |
|
| 4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
@app.post("/")
|
| 10 |
-
async def predict(data: Input):
|
| 11 |
-
try:
|
| 12 |
-
ventas = list(map(float, data.inputs.split(',')))
|
| 13 |
-
if len(ventas) < 2:
|
| 14 |
-
return {"result": "Datos insuficientes"}
|
| 15 |
-
return {"result": "Bien" if ventas[-1] > ventas[-2] else "Mal"}
|
| 16 |
-
except:
|
| 17 |
-
return {"result": "Error en datos"}
|
|
|
|
| 1 |
+
import gradio as gr
|
|
|
|
| 2 |
|
| 3 |
+
def crecimiento_ventas(ventas_str):
|
| 4 |
+
ventas = list(map(float, ventas_str.split(',')))
|
| 5 |
+
if len(ventas) < 2:
|
| 6 |
+
return "Datos insuficientes"
|
| 7 |
+
return "Bien" if ventas[-1] > ventas[-2] else "Mal"
|
| 8 |
|
| 9 |
+
iface = gr.Interface(fn=crecimiento_ventas, inputs="text", outputs="text")
|
| 10 |
+
iface.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|