lalith
commited on
Commit
•
cdd66db
1
Parent(s):
67a2e99
app and requirements
Browse files- app.py +0 -5
- requirements.txt +2 -0
app.py
CHANGED
@@ -10,9 +10,6 @@ with gr.Blocks() as demo:
|
|
10 |
frames = []
|
11 |
def get_frame(video):
|
12 |
frames.clear()
|
13 |
-
files = glob.glob('frames/*')
|
14 |
-
for f in files:
|
15 |
-
os.remove(f)
|
16 |
cap = cv2.VideoCapture(video.name)
|
17 |
i = 0
|
18 |
for i in range(201):
|
@@ -20,13 +17,11 @@ with gr.Blocks() as demo:
|
|
20 |
if ret == False:
|
21 |
break
|
22 |
frames.append(frame)
|
23 |
-
# cv2.imwrite("frames/frame_{}.jpeg".format(i),frame)
|
24 |
i += 1
|
25 |
cap.release()
|
26 |
cv2.destroyAllWindows()
|
27 |
video_upload.upload(fn=get_frame, inputs=[video_upload])
|
28 |
def return_frame(index):
|
29 |
-
# img = cv2.imread("frames/frame_{}.jpeg".format(index))
|
30 |
img = frames[index]
|
31 |
return img
|
32 |
slider.change(return_frame,slider,gr.Image(shape=(1280, 720),type="numpy"))
|
|
|
10 |
frames = []
|
11 |
def get_frame(video):
|
12 |
frames.clear()
|
|
|
|
|
|
|
13 |
cap = cv2.VideoCapture(video.name)
|
14 |
i = 0
|
15 |
for i in range(201):
|
|
|
17 |
if ret == False:
|
18 |
break
|
19 |
frames.append(frame)
|
|
|
20 |
i += 1
|
21 |
cap.release()
|
22 |
cv2.destroyAllWindows()
|
23 |
video_upload.upload(fn=get_frame, inputs=[video_upload])
|
24 |
def return_frame(index):
|
|
|
25 |
img = frames[index]
|
26 |
return img
|
27 |
slider.change(return_frame,slider,gr.Image(shape=(1280, 720),type="numpy"))
|
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
opencv-python
|
2 |
+
numpy
|