Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -10,13 +10,14 @@ from concurrent.futures import ThreadPoolExecutor, as_completed, TimeoutError
|
|
| 10 |
|
| 11 |
# -------------------- CONFIG --------------------
|
| 12 |
model_paths = {
|
| 13 |
-
"
|
| 14 |
-
"pig1": "pig1.pt", # β
|
| 15 |
"combine": "combine.pt", # β
combine model
|
| 16 |
"wrinkle": "wrinkle.pt",
|
| 17 |
}
|
| 18 |
default_conf_threshold = 0.05
|
| 19 |
-
special_conf_threshold = 0.08 # β
|
|
|
|
| 20 |
imgsz = 1024
|
| 21 |
|
| 22 |
# -------------------- INIT --------------------
|
|
@@ -79,8 +80,10 @@ def detect_skin_type_from_image(img):
|
|
| 79 |
|
| 80 |
# -------------------- HELPERS --------------------
|
| 81 |
def run_model(model_name, model, img, face_polygon, face_area):
|
| 82 |
-
# β
|
| 83 |
-
if model_name
|
|
|
|
|
|
|
| 84 |
conf = special_conf_threshold
|
| 85 |
else:
|
| 86 |
conf = default_conf_threshold
|
|
|
|
| 10 |
|
| 11 |
# -------------------- CONFIG --------------------
|
| 12 |
model_paths = {
|
| 13 |
+
"pores2": "pores2.pt",
|
| 14 |
+
"pig1": "pig1.pt", # β
pigmentation model
|
| 15 |
"combine": "combine.pt", # β
combine model
|
| 16 |
"wrinkle": "wrinkle.pt",
|
| 17 |
}
|
| 18 |
default_conf_threshold = 0.05
|
| 19 |
+
special_conf_threshold = 0.08 # β
for combine & pig1
|
| 20 |
+
pores2_conf_threshold = 0.12 # β
special for pores2
|
| 21 |
imgsz = 1024
|
| 22 |
|
| 23 |
# -------------------- INIT --------------------
|
|
|
|
| 80 |
|
| 81 |
# -------------------- HELPERS --------------------
|
| 82 |
def run_model(model_name, model, img, face_polygon, face_area):
|
| 83 |
+
# β
confidence logic
|
| 84 |
+
if model_name == "pores2":
|
| 85 |
+
conf = pores2_conf_threshold
|
| 86 |
+
elif model_name in ["combine", "pig1"]:
|
| 87 |
conf = special_conf_threshold
|
| 88 |
else:
|
| 89 |
conf = default_conf_threshold
|