amirgame197 commited on
Commit
613494a
1 Parent(s): 6db6005

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -15,9 +15,10 @@ def doo(video):
15
  fps = cap.get(cv2.CAP_PROP_FPS)
16
 
17
  processed_frames = 0
18
- writer = None
19
 
20
  while cap.isOpened():
 
21
  ret, frame = cap.read()
22
 
23
  if ret is False:
@@ -38,12 +39,12 @@ def doo(video):
38
  if processed_frames % 100 == 0:
39
  processed_frames = 0
40
  del out # Delete the variable holding the processed frame
41
- writer.release()
42
  gc.collect() # Perform manual garbage collection to release GPU memory
43
  print("Memory reset")
44
 
45
  cap.release()
46
- writer.release()
47
  return 'output.mp4'
48
 
49
  iface = gr.Interface(fn=doo, inputs="video", outputs="video")
 
15
  fps = cap.get(cv2.CAP_PROP_FPS)
16
 
17
  processed_frames = 0
18
+ #writer = None
19
 
20
  while cap.isOpened():
21
+ writer = None
22
  ret, frame = cap.read()
23
 
24
  if ret is False:
 
39
  if processed_frames % 100 == 0:
40
  processed_frames = 0
41
  del out # Delete the variable holding the processed frame
42
+ del writer
43
  gc.collect() # Perform manual garbage collection to release GPU memory
44
  print("Memory reset")
45
 
46
  cap.release()
47
+ #writer.release()
48
  return 'output.mp4'
49
 
50
  iface = gr.Interface(fn=doo, inputs="video", outputs="video")