amirgame197
commited on
Commit
•
dded11c
1
Parent(s):
482af29
Update app.py
Browse files
app.py
CHANGED
@@ -7,7 +7,7 @@ import time
|
|
7 |
from PIL import Image
|
8 |
from transparent_background import Remover
|
9 |
|
10 |
-
remover = Remover()
|
11 |
|
12 |
@spaces.GPU
|
13 |
def doo(video):
|
@@ -17,13 +17,17 @@ def doo(video):
|
|
17 |
writer = None
|
18 |
|
19 |
processed_frames = 0
|
|
|
20 |
|
21 |
while cap.isOpened():
|
22 |
ret, frame = cap.read()
|
23 |
|
24 |
if ret is False:
|
25 |
break
|
26 |
-
|
|
|
|
|
|
|
27 |
frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
|
28 |
img = Image.fromarray(frame).convert('RGB')
|
29 |
|
|
|
7 |
from PIL import Image
|
8 |
from transparent_background import Remover
|
9 |
|
10 |
+
remover = Remover(mode='fast')
|
11 |
|
12 |
@spaces.GPU
|
13 |
def doo(video):
|
|
|
17 |
writer = None
|
18 |
|
19 |
processed_frames = 0
|
20 |
+
start_time = time.time()
|
21 |
|
22 |
while cap.isOpened():
|
23 |
ret, frame = cap.read()
|
24 |
|
25 |
if ret is False:
|
26 |
break
|
27 |
+
|
28 |
+
if time.time() - start_time >= 60:
|
29 |
+
print("GPU Timeout is coming")
|
30 |
+
return 'output.mp4'
|
31 |
frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
|
32 |
img = Image.fromarray(frame).convert('RGB')
|
33 |
|