Pinwheel commited on
Commit
2c37148
1 Parent(s): 9eaaad8

Add webcam

Browse files
Files changed (1) hide show
  1. app.py +14 -0
app.py CHANGED
@@ -100,8 +100,22 @@ with gr.Blocks() as demo:
100
  with gr.Column():
101
  video_output = gr.outputs.Image(type="pil", label="grounding results")
102
  vqa_output_video = gr.Textbox(label="Answer")
 
 
 
 
 
 
 
 
 
 
 
 
 
103
 
104
  image_button.click(predict_image, inputs=[image_input, obj_input, vqa_input], outputs=[image_output, vqa_output])
105
  video_button.click(predict_video, inputs=[video_input, obj_input_video, vqa_input_video, frame_drop_input], outputs=[video_output, vqa_output_video])
 
106
  demo.queue()
107
  demo.launch()
 
100
  with gr.Column():
101
  video_output = gr.outputs.Image(type="pil", label="grounding results")
102
  vqa_output_video = gr.Textbox(label="Answer")
103
+
104
+ with gr.Tab("Webcam"):
105
+ with gr.Row():
106
+ with gr.Column():
107
+ cam_input = gr.Video(label='input video', mirror_webcam=False, source="webcam")
108
+ obj_input_cam = gr.Textbox(label='Objects', lines=1, placeholder="Objects here..")
109
+ vqa_input_cam = gr.Textbox(label='Question', lines=1, placeholder="Question here..")
110
+ frame_drop_input_cam = gr.Slider(label='Frames drop value', minimum=0, maximum=30, step=1, value=5)
111
+ cam_button = gr.Button("Submit")
112
+
113
+ with gr.Column():
114
+ cam_output = gr.outputs.Image(type="pil", label="grounding results")
115
+ vqa_output_cam = gr.Textbox(label="Answer")
116
 
117
  image_button.click(predict_image, inputs=[image_input, obj_input, vqa_input], outputs=[image_output, vqa_output])
118
  video_button.click(predict_video, inputs=[video_input, obj_input_video, vqa_input_video, frame_drop_input], outputs=[video_output, vqa_output_video])
119
+ cam_button.click(predict_video, inputs=[cam_input, obj_input_cam, vqa_input_cam, frame_drop_input_cam], outputs=[cam_output, vqa_output_cam])
120
  demo.queue()
121
  demo.launch()