AshanGimhana
commited on
Commit
•
0670f39
1
Parent(s):
d366e7d
Update app.py
Browse files
app.py
CHANGED
@@ -46,7 +46,7 @@ sam_ffhq_aging = hf_hub_download(repo_id="AshanGimhana/Face_Agin_model", filenam
|
|
46 |
new_age_model = load_model("age_prediction_model.h5")
|
47 |
|
48 |
# Age prediction model setup
|
49 |
-
age_net = cv2.dnn.readNetFromCaffe(age_prototxt, caffe_model)
|
50 |
|
51 |
# Face detection and landmarks predictor setup
|
52 |
detector = dlib.get_frontal_face_detector()
|
@@ -112,11 +112,8 @@ def get_mouth_region(image):
|
|
112 |
return np.array(mouth_points, np.int32)
|
113 |
return None
|
114 |
|
|
|
115 |
# Function to predict age
|
116 |
-
def get_age(distr):
|
117 |
-
# Convert distribution to approximate age by scaling
|
118 |
-
age = distr * 4
|
119 |
-
return age
|
120 |
|
121 |
def predict_age(image):
|
122 |
image = np.array(image.resize((64, 64)))
|
|
|
46 |
new_age_model = load_model("age_prediction_model.h5")
|
47 |
|
48 |
# Age prediction model setup
|
49 |
+
# age_net = cv2.dnn.readNetFromCaffe(age_prototxt, caffe_model)
|
50 |
|
51 |
# Face detection and landmarks predictor setup
|
52 |
detector = dlib.get_frontal_face_detector()
|
|
|
112 |
return np.array(mouth_points, np.int32)
|
113 |
return None
|
114 |
|
115 |
+
|
116 |
# Function to predict age
|
|
|
|
|
|
|
|
|
117 |
|
118 |
def predict_age(image):
|
119 |
image = np.array(image.resize((64, 64)))
|