Spaces:
Running on Zero
Running on Zero
Upload app.py with huggingface_hub
Browse files
app.py
CHANGED
|
@@ -236,13 +236,15 @@ TRACKER = {
|
|
| 236 |
|
| 237 |
log.info("loading Sapiens2 (448x336)")
|
| 238 |
SAPIENS2 = {res: None for res in ("448x336", "576x432", "1024x768")}
|
| 239 |
-
|
|
|
|
|
|
|
| 240 |
|
| 241 |
log.info("loading SAM 3D Body")
|
| 242 |
-
SAM_BODY = SamBodyFeatures(ASSETS.sam_3d_body)
|
| 243 |
|
| 244 |
log.info("loading HaMeR")
|
| 245 |
-
HAMER = HamerHandFeatures(ASSETS.hamer)
|
| 246 |
|
| 247 |
MODELS_LOCK = threading.Lock()
|
| 248 |
|
|
@@ -251,7 +253,9 @@ def _get_sapiens2(resolution: str) -> Sapiens2Keypoints:
|
|
| 251 |
"""The 448x336 model loads at startup; other resolutions lazily on first use."""
|
| 252 |
with MODELS_LOCK:
|
| 253 |
if SAPIENS2.get(resolution) is None:
|
| 254 |
-
SAPIENS2[resolution] = Sapiens2Keypoints(
|
|
|
|
|
|
|
| 255 |
return SAPIENS2[resolution]
|
| 256 |
|
| 257 |
|
|
|
|
| 236 |
|
| 237 |
log.info("loading Sapiens2 (448x336)")
|
| 238 |
SAPIENS2 = {res: None for res in ("448x336", "576x432", "1024x768")}
|
| 239 |
+
# num_workers=0: the ZeroGPU worker process is daemonic, and DataLoader workers are
|
| 240 |
+
# child processes -> "daemonic processes are not allowed to have children".
|
| 241 |
+
SAPIENS2["448x336"] = Sapiens2Keypoints(ASSETS.sapiens2, resolution="448x336", num_workers=0)
|
| 242 |
|
| 243 |
log.info("loading SAM 3D Body")
|
| 244 |
+
SAM_BODY = SamBodyFeatures(ASSETS.sam_3d_body, num_workers=0)
|
| 245 |
|
| 246 |
log.info("loading HaMeR")
|
| 247 |
+
HAMER = HamerHandFeatures(ASSETS.hamer, num_workers=0)
|
| 248 |
|
| 249 |
MODELS_LOCK = threading.Lock()
|
| 250 |
|
|
|
|
| 253 |
"""The 448x336 model loads at startup; other resolutions lazily on first use."""
|
| 254 |
with MODELS_LOCK:
|
| 255 |
if SAPIENS2.get(resolution) is None:
|
| 256 |
+
SAPIENS2[resolution] = Sapiens2Keypoints(
|
| 257 |
+
ASSETS.sapiens2, resolution=resolution, num_workers=0
|
| 258 |
+
)
|
| 259 |
return SAPIENS2[resolution]
|
| 260 |
|
| 261 |
|