Spaces:
Running
on
Zero
Running
on
Zero
elucidator8918
commited on
Commit
•
8b83fe8
1
Parent(s):
2d8937f
Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
import cv2
|
|
|
2 |
import numpy as np
|
3 |
from tensorflow.keras.models import load_model
|
4 |
import gradio as gr
|
@@ -14,7 +15,7 @@ def preprocess_frame(frame):
|
|
14 |
normalized_frame = resized_frame / 255.0
|
15 |
return np.expand_dims(normalized_frame, axis=0) # Add batch dimension
|
16 |
|
17 |
-
|
18 |
def predict_drowsiness(video_path):
|
19 |
# Open the video file
|
20 |
cap = cv2.VideoCapture(video_path)
|
|
|
1 |
import cv2
|
2 |
+
import spaces
|
3 |
import numpy as np
|
4 |
from tensorflow.keras.models import load_model
|
5 |
import gradio as gr
|
|
|
15 |
normalized_frame = resized_frame / 255.0
|
16 |
return np.expand_dims(normalized_frame, axis=0) # Add batch dimension
|
17 |
|
18 |
+
@spaces.GPU(duration=120)
|
19 |
def predict_drowsiness(video_path):
|
20 |
# Open the video file
|
21 |
cap = cv2.VideoCapture(video_path)
|