Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -51,7 +51,7 @@ def predict(pilimg,video_in_filepath,threshold):
|
|
| 51 |
if pilimg:
|
| 52 |
image_np = pil_image_as_numpy_array(pilimg)
|
| 53 |
return predict2(image_np,threshold),None
|
| 54 |
-
|
| 55 |
video_reader = cv2.VideoCapture(video_in_filepath)
|
| 56 |
|
| 57 |
nb_frames = int(video_reader.get(cv2.CAP_PROP_FRAME_COUNT))
|
|
@@ -91,7 +91,8 @@ def predict(pilimg,video_in_filepath,threshold):
|
|
| 91 |
cv2.destroyAllWindows()
|
| 92 |
cv2.waitKey(1)
|
| 93 |
return None,video_out_filepath
|
| 94 |
-
|
|
|
|
| 95 |
|
| 96 |
|
| 97 |
def predict2(image_np,threshold):
|
|
|
|
| 51 |
if pilimg:
|
| 52 |
image_np = pil_image_as_numpy_array(pilimg)
|
| 53 |
return predict2(image_np,threshold),None
|
| 54 |
+
elif video_in_filepath:
|
| 55 |
video_reader = cv2.VideoCapture(video_in_filepath)
|
| 56 |
|
| 57 |
nb_frames = int(video_reader.get(cv2.CAP_PROP_FRAME_COUNT))
|
|
|
|
| 91 |
cv2.destroyAllWindows()
|
| 92 |
cv2.waitKey(1)
|
| 93 |
return None,video_out_filepath
|
| 94 |
+
else:
|
| 95 |
+
return None, None
|
| 96 |
|
| 97 |
|
| 98 |
def predict2(image_np,threshold):
|