Myloiose commited on
Commit
5de2976
·
verified ·
1 Parent(s): bcb2158

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -15
app.py CHANGED
@@ -1,17 +1,10 @@
1
- from fastapi import FastAPI
2
- from pydantic import BaseModel
3
 
4
- app = FastAPI()
 
 
 
 
5
 
6
- class Input(BaseModel):
7
- inputs: str
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()