Myloiose commited on
Commit
cd2e052
·
verified ·
1 Parent(s): aa44635

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -1,15 +1,15 @@
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(
10
- fn=crecimiento_ventas,
11
- inputs=gr.Textbox(lines=1, placeholder="100,200,300"),
12
- outputs="text"
13
- )
14
 
15
- iface.launch()
 
1
  import gradio as gr
2
 
3
+ app = gr.Blocks()
4
+
5
  def crecimiento_ventas(ventas_str):
6
  ventas = list(map(float, ventas_str.split(',')))
7
  if len(ventas) < 2:
8
  return "Datos insuficientes"
9
  return "Bien" if ventas[-1] > ventas[-2] else "Mal"
10
 
11
+ @app.api(input=gr.Textbox(), output=gr.Textbox())
12
+ def api_crecimiento(ventas_str):
13
+ return crecimiento_ventas(ventas_str)
 
 
14
 
15
+ app.launch()