miojizzy commited on
Commit
346e501
·
1 Parent(s): f75b219

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +33 -44
app.py CHANGED
@@ -28,63 +28,52 @@ def greet2(v):
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") )
40
 
41
-
42
- #with gr.Blocks() as demo:
43
- # with gr.Row():
44
- # #input = gr.Video()
45
- # input = [gr.Textbox()]
46
- # output = [gr.Textbox()]
47
- # btn = gr.Button(value="Submit")
48
- # btn.click(greet3, inputs=input, outputs=output)
49
- #
50
- # gr.Examples(
51
- # examples=[["qweasd"]],
52
- # inputs=input,
53
- # outputs=output,
54
- # fn=greet3,
55
- # cache_examples=True,
56
- # )
57
-
58
- #demo.queue().launch(debug=True)
59
-
60
- def my_function(x,y, progress=gr.Progress()):
61
- progress(0, desc="Starting...")
62
- time.sleep(1)
63
- for i in progress.tqdm(range(100)):
64
- time.sleep(0.1)
65
- return x+y
66
-
67
-
68
  with gr.Blocks() as demo:
69
-
70
  with gr.Row():
71
- input1 = gr.Textbox()
72
- input2 = gr.Textbox()
73
- output = gr.Textbox()
74
  btn = gr.Button(value="Submit")
75
- btn.click(my_function, inputs=[input1,input2], outputs=output)
76
 
77
  gr.Examples(
78
- [["hi", "Adam"], ["hello", "Eve"]],
79
- [input1, input2],
80
- output,
81
- my_function,
82
  cache_examples=False,
83
  )
84
- #demo = gr.Interface(
85
- # my_function,
86
- # gr.Textbox(),
87
- # gr.Textbox(),
88
- #)
89
 
90
- demo.queue().launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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") )
40
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
  with gr.Blocks() as demo:
 
42
  with gr.Row():
43
+ input = gr.Video()
44
+ #input = [gr.Textbox()]
45
+ output = [gr.Textbox()]
46
  btn = gr.Button(value="Submit")
47
+ btn.click(greet, inputs=input, outputs=output)
48
 
49
  gr.Examples(
50
+ examples=[os.path.join(os.path.dirname(__file__), "example/test.mp4")],
51
+ inputs=input,
52
+ outputs=output,
53
+ fn=greet,
54
  cache_examples=False,
55
  )
56
+ demo.queue().launch(debug=True)
57
+
 
 
 
58
 
59
+ #def my_function(x,y, progress=gr.Progress()):
60
+ # progress(0, desc="Starting...")
61
+ # time.sleep(1)
62
+ # for i in progress.tqdm(range(100)):
63
+ # time.sleep(0.1)
64
+ # return x+y
65
+ #with gr.Blocks() as demo:
66
+ # with gr.Row():
67
+ # input1 = gr.Textbox()
68
+ # input2 = gr.Textbox()
69
+ # output = gr.Textbox()
70
+ # btn = gr.Button(value="Submit")
71
+ # btn.click(my_function, inputs=[input1,input2], outputs=output)
72
+ # gr.Examples(
73
+ # [["hi", "Adam"], ["hello", "Eve"]],
74
+ # [input1, input2],
75
+ # output,
76
+ # my_function,
77
+ # cache_examples=False,
78
+ # )
79
+ #demo.queue().launch()