miojizzy commited on
Commit
a9eb8ce
·
1 Parent(s): 2aef4f6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -8
app.py CHANGED
@@ -1,7 +1,6 @@
1
  import os
2
  import cv2 as cv
3
 
4
-
5
  import gradio as gr
6
 
7
 
@@ -21,31 +20,48 @@ def get_nth_frame(v, n):
21
  img = cv.cvtColor(img, cv.COLOR_BGR2RGB)
22
  vc.release()
23
  return img
24
-
 
 
 
25
  with gr.Blocks() as demo2:
26
- with gr.Tab("get nth frame"):
27
  with gr.Row():
28
  with gr.Column():
29
  input_video = gr.Video()
30
- with gr.Accordion('video info'):
31
  output_fps = gr.Textbox(lines=1, label="fps")
32
  output_fms = gr.Textbox(lines=1, label="frame count")
33
  output_w = gr.Textbox(lines=1, label="width")
34
  output_h = gr.Textbox(lines=1, label="height")
35
  with gr.Column():
36
  output_img = gr.Image()
37
- input_n = gr.Slider(0, 9999, value=0, step=1, label="n")
38
- btn = gr.Button(value="Submit")
 
39
  input_video.change(
40
  video_change,
41
  inputs=[input_video],
42
  outputs=[output_fps, output_fms, output_w, output_h, input_n]
43
  )
44
-
45
  btn.click(get_nth_frame, inputs=[input_video, input_n], outputs=output_img)
 
 
 
 
 
 
 
 
 
46
 
47
- gr.Examples([os.path.join(os.path.dirname(__file__), "test.mp4")], inputs=input_video)
 
48
 
 
 
 
 
49
 
50
 
51
 
 
1
  import os
2
  import cv2 as cv
3
 
 
4
  import gradio as gr
5
 
6
 
 
20
  img = cv.cvtColor(img, cv.COLOR_BGR2RGB)
21
  vc.release()
22
  return img
23
+
24
+
25
+
26
+
27
  with gr.Blocks() as demo2:
28
+ with gr.Tab("Create Image Classify Dataset"):
29
  with gr.Row():
30
  with gr.Column():
31
  input_video = gr.Video()
32
+ with gr.Accordion('Video Info'):
33
  output_fps = gr.Textbox(lines=1, label="fps")
34
  output_fms = gr.Textbox(lines=1, label="frame count")
35
  output_w = gr.Textbox(lines=1, label="width")
36
  output_h = gr.Textbox(lines=1, label="height")
37
  with gr.Column():
38
  output_img = gr.Image()
39
+ with gr.Accordion('Show Frame'):
40
+ input_n = gr.Slider(0, 9999, value=0, step=1, label="n")
41
+ btn = gr.Button(value="Submit")
42
  input_video.change(
43
  video_change,
44
  inputs=[input_video],
45
  outputs=[output_fps, output_fms, output_w, output_h, input_n]
46
  )
 
47
  btn.click(get_nth_frame, inputs=[input_video, input_n], outputs=output_img)
48
+
49
+ gr.Markdown("*****")
50
+
51
+ df = gr.Dataframe(
52
+ headers=["start index", "end index", "label"],
53
+ datatype=["number", "number", "number"],
54
+ row_count=(0, 'dynamic'),
55
+ col_count=(3, "fixed"),
56
+ )
57
 
58
+ btn_add_segm = gr.Button(value="create dataset")
59
+ #btn.click(add_segment, inputs=segms, outputs=segms)
60
 
61
+ gr.Markdown("*****")
62
+
63
+ gr.Examples([os.path.join(os.path.dirname(__file__), "test.mp4")], inputs=input_video)
64
+
65
 
66
 
67