Update app.py
Browse files
app.py
CHANGED
@@ -11,16 +11,14 @@ import math
|
|
11 |
import torch
|
12 |
from torch import nn
|
13 |
from PIL import Image
|
14 |
-
|
15 |
-
from feat.utils.io import get_resource_path
|
16 |
-
from feat.pretrained import get_pretrained_models
|
17 |
|
18 |
CLASS_LABELS = ['angry', 'disgust', 'fear', 'happy', 'neutral', 'sad', 'surprise']
|
19 |
|
20 |
def _get_resource_path():
|
21 |
return "/home/user/app/resources"
|
22 |
|
23 |
-
get_resource_path = _get_resource_path
|
24 |
|
25 |
def _get_pretrained_models(face_model, landmark_model, au_model, emotion_model, facepose_model, verbose):
|
26 |
return (
|
@@ -30,8 +28,10 @@ def _get_pretrained_models(face_model, landmark_model, au_model, emotion_model,
|
|
30 |
emotion_model,
|
31 |
facepose_model,
|
32 |
)
|
33 |
-
get_pretrained_models = _get_pretrained_models
|
34 |
|
|
|
|
|
|
|
35 |
|
36 |
def _calculate_md5(fpath: str, chunk_size: int = 1024 * 1024) -> str:
|
37 |
# Setting the `usedforsecurity` flag does not change anything about the functionality, but indicates that we are
|
|
|
11 |
import torch
|
12 |
from torch import nn
|
13 |
from PIL import Image
|
14 |
+
import feat
|
|
|
|
|
15 |
|
16 |
CLASS_LABELS = ['angry', 'disgust', 'fear', 'happy', 'neutral', 'sad', 'surprise']
|
17 |
|
18 |
def _get_resource_path():
|
19 |
return "/home/user/app/resources"
|
20 |
|
21 |
+
feat.utils.io.get_resource_path = _get_resource_path
|
22 |
|
23 |
def _get_pretrained_models(face_model, landmark_model, au_model, emotion_model, facepose_model, verbose):
|
24 |
return (
|
|
|
28 |
emotion_model,
|
29 |
facepose_model,
|
30 |
)
|
|
|
31 |
|
32 |
+
feat.pretrained.get_pretrained_models = _get_pretrained_models
|
33 |
+
|
34 |
+
from feat import Detector
|
35 |
|
36 |
def _calculate_md5(fpath: str, chunk_size: int = 1024 * 1024) -> str:
|
37 |
# Setting the `usedforsecurity` flag does not change anything about the functionality, but indicates that we are
|