Moibe commited on
Commit
e43c0da
·
1 Parent(s): 7242d73

Simplificación de ejemplo

Browse files
Files changed (1) hide show
  1. app.py +7 -12
app.py CHANGED
@@ -16,28 +16,23 @@ get_local_storage = """
16
  """
17
 
18
 
19
- def predict(text_input, dropdown):
20
- return {
21
- "text": text_input,
22
- "dropdown": dropdown,
23
- "something_else": [text_input] * 3 + [dropdown],
24
- }
25
-
26
 
27
  with gr.Blocks() as block:
28
  tokens_label = gr.Label("Etiqueta")
29
 
30
  text_input = gr.Text(label="Input183")
31
- local_data = gr.JSON({}, label="Resultado")
32
 
33
  text_input.change(None, text_input, None, _js="(v)=>{ getStorage('text_input') }")
34
- local_data.change(None, local_data, None, _js="(v)=>{ setStorage('local_data',v) }")
35
- btn = gr.Button("Set New Data")
36
- btn.click(fn=predict, inputs=[text_input], outputs=[local_data])
37
  valores = block.load(
38
  None,
39
  inputs=None,
40
  outputs=[text_input, local_data],
41
  _js=get_local_storage,
42
  )
43
- block.launch(debug=True)
 
16
  """
17
 
18
 
19
+ def predict(text_input):
20
+ return "Hola mundo, éste es el resultado."
 
 
 
 
 
21
 
22
  with gr.Blocks() as block:
23
  tokens_label = gr.Label("Etiqueta")
24
 
25
  text_input = gr.Text(label="Input183")
26
+ resultadoFinal = gr.Text(label="ResulAquí")
27
 
28
  text_input.change(None, text_input, None, _js="(v)=>{ getStorage('text_input') }")
29
+ resultadoFinal.change(None, local_data, None, _js="(v)=>{ setStorage('local_data',v) }")
30
+ btn = gr.Button("Enviar")
31
+ btn.click(fn=predict, inputs=[text_input], outputs=[resultadoFinal])
32
  valores = block.load(
33
  None,
34
  inputs=None,
35
  outputs=[text_input, local_data],
36
  _js=get_local_storage,
37
  )
38
+ block.launch(debug=True)