Spaces:
Runtime error
Runtime error
added the keras
Browse files
app.py
CHANGED
|
@@ -6,7 +6,7 @@ import numpy as np
|
|
| 6 |
from PIL import Image
|
| 7 |
import cv2
|
| 8 |
from tensorflow.keras.preprocessing import image
|
| 9 |
-
|
| 10 |
|
| 11 |
emotion_labels = {'angry': 0, 'disgust': 1, 'fear': 2, 'happy': 3, 'neutral': 4, 'sad': 5, 'surprise': 6}
|
| 12 |
index_to_emotion = {v: k for k, v in emotion_labels.items()}
|
|
@@ -15,7 +15,7 @@ model = keras.models.load_model('ED_model_RT_19.keras')
|
|
| 15 |
|
| 16 |
|
| 17 |
def prepare_image(img_pil):
|
| 18 |
-
|
| 19 |
# Convert the PIL image to a numpy array with the target size
|
| 20 |
img = img_pil.resize((224, 224))
|
| 21 |
img_array = img_to_array(img)
|
|
|
|
| 6 |
from PIL import Image
|
| 7 |
import cv2
|
| 8 |
from tensorflow.keras.preprocessing import image
|
| 9 |
+
import keras
|
| 10 |
|
| 11 |
emotion_labels = {'angry': 0, 'disgust': 1, 'fear': 2, 'happy': 3, 'neutral': 4, 'sad': 5, 'surprise': 6}
|
| 12 |
index_to_emotion = {v: k for k, v in emotion_labels.items()}
|
|
|
|
| 15 |
|
| 16 |
|
| 17 |
def prepare_image(img_pil):
|
| 18 |
+
|
| 19 |
# Convert the PIL image to a numpy array with the target size
|
| 20 |
img = img_pil.resize((224, 224))
|
| 21 |
img_array = img_to_array(img)
|