Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -4,6 +4,8 @@ import numpy as np
|
|
4 |
from tensorflow.keras.models import load_model
|
5 |
import gradio as gr
|
6 |
import tempfile
|
|
|
|
|
7 |
|
8 |
# Function to preprocess each frame
|
9 |
def preprocess_frame(frame):
|
@@ -35,7 +37,6 @@ def predict_drowsiness(video_path):
|
|
35 |
preprocessed_frame = preprocess_frame(frame)
|
36 |
|
37 |
# Use the model to predict drowsiness
|
38 |
-
model = load_model('cnn.keras')
|
39 |
prediction = model.predict(preprocessed_frame)
|
40 |
drowsiness = np.argmax(prediction)
|
41 |
|
|
|
4 |
from tensorflow.keras.models import load_model
|
5 |
import gradio as gr
|
6 |
import tempfile
|
7 |
+
print(tf.config.list_physical_devices("GPU"))
|
8 |
+
model = load_model('cnn.keras')
|
9 |
|
10 |
# Function to preprocess each frame
|
11 |
def preprocess_frame(frame):
|
|
|
37 |
preprocessed_frame = preprocess_frame(frame)
|
38 |
|
39 |
# Use the model to predict drowsiness
|
|
|
40 |
prediction = model.predict(preprocessed_frame)
|
41 |
drowsiness = np.argmax(prediction)
|
42 |
|