Spaces:
Runtime error
Runtime error
Rawal Khirodkar commited on
Commit ·
c507c2e
1
Parent(s): bf3b357
Pointmap: ship-mode — preload all sizes, default to 1B
Browse files
app.py
CHANGED
|
@@ -59,7 +59,7 @@ POINTMAP_MODELS = {
|
|
| 59 |
"config": os.path.join(CONFIGS_DIR, "sapiens2_5b_pointmap_render_people-1024x768.py"),
|
| 60 |
},
|
| 61 |
}
|
| 62 |
-
DEFAULT_SIZE = "
|
| 63 |
|
| 64 |
FG_REPO = "facebook/sapiens-seg-foreground-1b-torchscript"
|
| 65 |
FG_FILENAME = "sapiens_1b_seg_foreground_epoch_8_torchscript.pt2"
|
|
@@ -99,8 +99,9 @@ def _get_fg_model():
|
|
| 99 |
return _fg_model
|
| 100 |
|
| 101 |
|
| 102 |
-
print("[startup] pre-loading
|
| 103 |
-
|
|
|
|
| 104 |
_get_fg_model()
|
| 105 |
print("[startup] ready.")
|
| 106 |
|
|
@@ -374,7 +375,7 @@ with gr.Blocks(title="Sapiens2 Pointmap", theme=gr.themes.Soft(), css=CUSTOM_CSS
|
|
| 374 |
with gr.Row():
|
| 375 |
with gr.Column(scale=2, min_width=320):
|
| 376 |
size = gr.Radio(
|
| 377 |
-
choices=
|
| 378 |
value=DEFAULT_SIZE,
|
| 379 |
label="Model",
|
| 380 |
container=False,
|
|
|
|
| 59 |
"config": os.path.join(CONFIGS_DIR, "sapiens2_5b_pointmap_render_people-1024x768.py"),
|
| 60 |
},
|
| 61 |
}
|
| 62 |
+
DEFAULT_SIZE = "1B"
|
| 63 |
|
| 64 |
FG_REPO = "facebook/sapiens-seg-foreground-1b-torchscript"
|
| 65 |
FG_FILENAME = "sapiens_1b_seg_foreground_epoch_8_torchscript.pt2"
|
|
|
|
| 99 |
return _fg_model
|
| 100 |
|
| 101 |
|
| 102 |
+
print("[startup] pre-loading all pointmap sizes + fg/bg ...")
|
| 103 |
+
for _size in POINTMAP_MODELS:
|
| 104 |
+
_get_pointmap_model(_size)
|
| 105 |
_get_fg_model()
|
| 106 |
print("[startup] ready.")
|
| 107 |
|
|
|
|
| 375 |
with gr.Row():
|
| 376 |
with gr.Column(scale=2, min_width=320):
|
| 377 |
size = gr.Radio(
|
| 378 |
+
choices=list(POINTMAP_MODELS.keys()),
|
| 379 |
value=DEFAULT_SIZE,
|
| 380 |
label="Model",
|
| 381 |
container=False,
|