Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -4,6 +4,7 @@ import numpy as np
|
|
4 |
import cv2
|
5 |
import matplotlib.pyplot as plt
|
6 |
import random
|
|
|
7 |
import time
|
8 |
from PIL import Image
|
9 |
from threading import Thread
|
@@ -26,6 +27,7 @@ model.eval()
|
|
26 |
#####################################
|
27 |
# 2. Helper Function: Downsample Video
|
28 |
#####################################
|
|
|
29 |
def downsample_video(video_path, num_frames=10):
|
30 |
"""
|
31 |
Downsamples the video file to `num_frames` evenly spaced frames.
|
@@ -54,6 +56,7 @@ def downsample_video(video_path, num_frames=10):
|
|
54 |
#####################################
|
55 |
# 3. The Inference Function
|
56 |
#####################################
|
|
|
57 |
def video_inference(video_file, duration):
|
58 |
"""
|
59 |
- Takes a recorded video file and a chosen duration (string).
|
|
|
4 |
import cv2
|
5 |
import matplotlib.pyplot as plt
|
6 |
import random
|
7 |
+
import spaces
|
8 |
import time
|
9 |
from PIL import Image
|
10 |
from threading import Thread
|
|
|
27 |
#####################################
|
28 |
# 2. Helper Function: Downsample Video
|
29 |
#####################################
|
30 |
+
|
31 |
def downsample_video(video_path, num_frames=10):
|
32 |
"""
|
33 |
Downsamples the video file to `num_frames` evenly spaced frames.
|
|
|
56 |
#####################################
|
57 |
# 3. The Inference Function
|
58 |
#####################################
|
59 |
+
@space.GPU
|
60 |
def video_inference(video_file, duration):
|
61 |
"""
|
62 |
- Takes a recorded video file and a chosen duration (string).
|