Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,10 +4,6 @@ import numpy as np
|
|
| 4 |
from tensorflow.keras.models import load_model
|
| 5 |
import gradio as gr
|
| 6 |
import tempfile
|
| 7 |
-
import os
|
| 8 |
-
os.environ['CUDA_VISIBLE_DEVICES'] = "0"
|
| 9 |
-
# Load your pre-trained model
|
| 10 |
-
model = load_model('cnn.keras')
|
| 11 |
|
| 12 |
# Function to preprocess each frame
|
| 13 |
def preprocess_frame(frame):
|
|
@@ -39,6 +35,7 @@ def predict_drowsiness(video_path):
|
|
| 39 |
preprocessed_frame = preprocess_frame(frame)
|
| 40 |
|
| 41 |
# Use the model to predict drowsiness
|
|
|
|
| 42 |
prediction = model.predict(preprocessed_frame)
|
| 43 |
drowsiness = np.argmax(prediction)
|
| 44 |
|
|
|
|
| 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 |
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 |
|