Spaces:
Runtime error
Runtime error
Commit
·
06d6683
1
Parent(s):
64f4123
updated
Browse files
app/Hackathon_setup/exp_recognition.py
CHANGED
|
@@ -69,10 +69,13 @@ def get_expression(img):
|
|
| 69 |
|
| 70 |
if face == 0:
|
| 71 |
face = Image.fromarray(cv2.cvtColor(img, cv2.COLOR_BGR2GRAY))
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
output = face_det_net(face)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 76 |
|
| 77 |
# YOUR CODE HERE, return expression using your model
|
| 78 |
|
|
|
|
| 69 |
|
| 70 |
if face == 0:
|
| 71 |
face = Image.fromarray(cv2.cvtColor(img, cv2.COLOR_BGR2GRAY))
|
| 72 |
+
|
| 73 |
+
with torch.no_grad():
|
|
|
|
| 74 |
output = face_det_net(face)
|
| 75 |
+
_, predicted = torch.max(output, 1)
|
| 76 |
+
|
| 77 |
+
predicted_expression = classes[predicted.item()]
|
| 78 |
+
|
| 79 |
|
| 80 |
# YOUR CODE HERE, return expression using your model
|
| 81 |
|