Spaces:
Sleeping
Sleeping
Reverting back to mobilenetv3 model
Browse files
app.py
CHANGED
|
@@ -9,12 +9,12 @@ IMG_HEIGHT = 64
|
|
| 9 |
IMG_WIDTH = 64
|
| 10 |
|
| 11 |
# Load the saved Keras model
|
| 12 |
-
model = load_model("
|
| 13 |
|
| 14 |
# Define the labels for ASL classes
|
| 15 |
labels = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J',
|
| 16 |
'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T',
|
| 17 |
-
'U', 'V', 'W', 'X', 'Y'
|
| 18 |
|
| 19 |
def preprocess_frame(frame):
|
| 20 |
"""Preprocess the video frame for the ASL model."""
|
|
@@ -52,7 +52,7 @@ def preprocess_frame_cnn(frame):
|
|
| 52 |
|
| 53 |
def predict_asl(frame):
|
| 54 |
"""Predict the ASL sign and return the label and probabilities."""
|
| 55 |
-
processed_frame =
|
| 56 |
predictions = model.predict(processed_frame) # Predict probabilities
|
| 57 |
predicted_label = labels[np.argmax(predictions)] # Get the class with the highest probability
|
| 58 |
|
|
|
|
| 9 |
IMG_WIDTH = 64
|
| 10 |
|
| 11 |
# Load the saved Keras model
|
| 12 |
+
model = load_model("model_01.keras")
|
| 13 |
|
| 14 |
# Define the labels for ASL classes
|
| 15 |
labels = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J',
|
| 16 |
'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T',
|
| 17 |
+
'U', 'V', 'W', 'X', 'Y']
|
| 18 |
|
| 19 |
def preprocess_frame(frame):
|
| 20 |
"""Preprocess the video frame for the ASL model."""
|
|
|
|
| 52 |
|
| 53 |
def predict_asl(frame):
|
| 54 |
"""Predict the ASL sign and return the label and probabilities."""
|
| 55 |
+
processed_frame = preprocess_frame(frame)
|
| 56 |
predictions = model.predict(processed_frame) # Predict probabilities
|
| 57 |
predicted_label = labels[np.argmax(predictions)] # Get the class with the highest probability
|
| 58 |
|