miojizzy commited on
Commit
05e446f
·
1 Parent(s): 68bbb55

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -28,12 +28,12 @@ def greet2(v):
28
  print(ret)
29
  return ret
30
 
31
- def greet3(x, progress=gr.Progress()):
32
  progress(0, desc="Starting...")
33
  time.sleep(1)
34
  for i in progress.tqdm(range(100)):
35
  time.sleep(0.1)
36
- return x
37
 
38
  print("1:", os.path.dirname(__file__))
39
  print("2:", os.path.join(os.path.dirname(__file__), "example/test.mp4") )
@@ -66,15 +66,16 @@ def combine(a, b):
66
  with gr.Blocks() as demo:
67
 
68
  txt = gr.Textbox(label="Input", lines=2)
 
69
  txt_3 = gr.Textbox(value="", label="Output")
70
  btn = gr.Button(value="Submit")
71
 
72
- btn.click(greet3, inputs=[txt], outputs=[txt_3])
73
 
74
  gr.Markdown("## Text Examples")
75
  gr.Examples(
76
- [["hi"], ["hello"]],
77
- txt,
78
  txt_3,
79
  greet3,
80
  cache_examples=True,
 
28
  print(ret)
29
  return ret
30
 
31
+ def greet3(x,y, progress=gr.Progress()):
32
  progress(0, desc="Starting...")
33
  time.sleep(1)
34
  for i in progress.tqdm(range(100)):
35
  time.sleep(0.1)
36
+ return x+y
37
 
38
  print("1:", os.path.dirname(__file__))
39
  print("2:", os.path.join(os.path.dirname(__file__), "example/test.mp4") )
 
66
  with gr.Blocks() as demo:
67
 
68
  txt = gr.Textbox(label="Input", lines=2)
69
+ txt_2 = gr.Textbox(label="Input 2")
70
  txt_3 = gr.Textbox(value="", label="Output")
71
  btn = gr.Button(value="Submit")
72
 
73
+ btn.click(greet3, inputs=[txt,txt_2], outputs=[txt_3])
74
 
75
  gr.Markdown("## Text Examples")
76
  gr.Examples(
77
+ [["hi", "h"], ["hello", "hell"]],
78
+ [txt, txt_2],
79
  txt_3,
80
  greet3,
81
  cache_examples=True,