Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -15,13 +15,13 @@ def classify_image(image, top_k):
|
|
15 |
age_result = {result['label']: result['score'] for result in age_result[:min(int(top_k), 8)]}
|
16 |
emotion_result = {result['label']: result['score'] for result in emotion_result[:min(int(top_k), 7)]}
|
17 |
|
18 |
-
|
19 |
comment = text_comment(list(age_result.keys())[0])
|
20 |
|
21 |
# Returning the classification result
|
22 |
return age_result, comment, emotion_result
|
23 |
|
24 |
-
#
|
25 |
def text_comment(pred_class):
|
26 |
match pred_class:
|
27 |
case "3-9":
|
|
|
15 |
age_result = {result['label']: result['score'] for result in age_result[:min(int(top_k), 8)]}
|
16 |
emotion_result = {result['label']: result['score'] for result in emotion_result[:min(int(top_k), 7)]}
|
17 |
|
18 |
+
|
19 |
comment = text_comment(list(age_result.keys())[0])
|
20 |
|
21 |
# Returning the classification result
|
22 |
return age_result, comment, emotion_result
|
23 |
|
24 |
+
# comment based on age
|
25 |
def text_comment(pred_class):
|
26 |
match pred_class:
|
27 |
case "3-9":
|