gina9726 commited on
Commit
331c201
1 Parent(s): 9ea86ee

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -11
app.py CHANGED
@@ -1,24 +1,24 @@
1
  import gradio as gr
2
 
3
  examples = [
4
- "https://ak.picdn.net/shutterstock/videos/21179416/preview/stock-footage-aerial-shot-winter-forest.mp4",
5
- "https://ak.picdn.net/shutterstock/videos/5629184/preview/stock-footage-senior-couple-looking-through-binoculars-on-sailboat-together-shot-on-red-epic-for-high-quality-k.mp4",
6
- "https://ak.picdn.net/shutterstock/videos/1063125190/preview/stock-footage-a-beautiful-cookie-with-oranges-lies-on-a-green-tablecloth.mp4"
7
  ]
8
 
9
- def predict(video):
10
- return "This is a test!", "0.75, 0.25"
11
 
12
  with gr.Blocks() as demo:
13
  with gr.Row():
14
  with gr.Column():
15
- video = gr.PlayableVideo(label="video")
16
  with gr.Column():
17
- pred = gr.Text(label="prediction")
18
- prob = gr.Text(label="probability")
19
- btn = gr.Button("Predict")
20
- btn.click(predict, inputs=[video], outputs=[pred, prob])
21
- gr.Examples(examples=examples, inputs=[video])
22
 
23
  if __name__ == "__main__":
24
  demo.launch()
 
1
  import gradio as gr
2
 
3
  examples = [
4
+ ["test1", "https://ak.picdn.net/shutterstock/videos/21179416/preview/stock-footage-aerial-shot-winter-forest.mp4"],
5
+ ["test2", "https://ak.picdn.net/shutterstock/videos/5629184/preview/stock-footage-senior-couple-looking-through-binoculars-on-sailboat-together-shot-on-red-epic-for-high-quality-k.mp4"],
6
+ ["test3", "https://ak.picdn.net/shutterstock/videos/1063125190/preview/stock-footage-a-beautiful-cookie-with-oranges-lies-on-a-green-tablecloth.mp4"]
7
  ]
8
 
9
+ def predict(label, video):
10
+ return label
11
 
12
  with gr.Blocks() as demo:
13
  with gr.Row():
14
  with gr.Column():
15
+ video = gr.PlayableVideo(label="video", title="Input Video")
16
  with gr.Column():
17
+ label = gr.Text(label="ground truth")
18
+ pred = gr.Text(label="prediction")
19
+ btn = gr.Button("Predict", variant="primary"))
20
+ btn.click(predict, inputs=[label, video], outputs=[pred])
21
+ gr.Examples(examples=examples, inputs=[label, video], cache_examples=True)
22
 
23
  if __name__ == "__main__":
24
  demo.launch()