Update app.py
Browse files
app.py
CHANGED
@@ -109,7 +109,7 @@ def proc_image(img, detector):
|
|
109 |
features = [torch.tensor(np.array(extract_features(*object)).astype(np.float32)).to(device) for object in zip(detected_landmarks[0], detected_faces[0])]
|
110 |
detected_emotions = [emo_model(facefeat).softmax(dim=0).argmax(dim=0).to("cpu") for facefeat in features]
|
111 |
assert len(detected_emotions) == faces_detected, "Number of faces and emotions are mismatched!"
|
112 |
-
|
113 |
for face, has_open_eyes, label in zip(detected_faces[0], (eye_dict[eyes] for eyes in is_eye_open), detected_emotions):
|
114 |
(x0, y0, x1, y1, p) = face
|
115 |
res_scale = img.shape[0]/704
|
@@ -171,7 +171,7 @@ with stream:
|
|
171 |
use_container_width= False
|
172 |
)
|
173 |
img = np.array(Image.open(frame))
|
174 |
-
pic.image(image_processing(img), width =
|
175 |
|
176 |
|
177 |
recog = st.toggle(":green[Emotion recogntion]", key = "stream", value = True)
|
|
|
109 |
features = [torch.tensor(np.array(extract_features(*object)).astype(np.float32)).to(device) for object in zip(detected_landmarks[0], detected_faces[0])]
|
110 |
detected_emotions = [emo_model(facefeat).softmax(dim=0).argmax(dim=0).to("cpu") for facefeat in features]
|
111 |
assert len(detected_emotions) == faces_detected, "Number of faces and emotions are mismatched!"
|
112 |
+
|
113 |
for face, has_open_eyes, label in zip(detected_faces[0], (eye_dict[eyes] for eyes in is_eye_open), detected_emotions):
|
114 |
(x0, y0, x1, y1, p) = face
|
115 |
res_scale = img.shape[0]/704
|
|
|
171 |
use_container_width= False
|
172 |
)
|
173 |
img = np.array(Image.open(frame))
|
174 |
+
pic.image(image_processing(img), width = None)
|
175 |
|
176 |
|
177 |
recog = st.toggle(":green[Emotion recogntion]", key = "stream", value = True)
|