Spaces:
Running
on
Zero
Running
on
Zero
Add GPU initialization function in app_v4.py to manage model and pipeline setup
Browse files
app_v4.py
CHANGED
|
@@ -37,9 +37,12 @@ def get_model():
|
|
| 37 |
|
| 38 |
# import subprocess
|
| 39 |
# # subprocess.run("rm -rf /data-nvme/zerogpu-offload/*", env={}, shell=True)
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
|
|
|
|
|
|
|
|
|
| 43 |
|
| 44 |
@spaces.GPU(duration=12)
|
| 45 |
@torch.no_grad()
|
|
|
|
| 37 |
|
| 38 |
# import subprocess
|
| 39 |
# # subprocess.run("rm -rf /data-nvme/zerogpu-offload/*", env={}, shell=True)
|
| 40 |
+
@spaces.GPU()
|
| 41 |
+
def init_space():
|
| 42 |
+
global pipe, model
|
| 43 |
+
pipe = get_model()["pipeline"]
|
| 44 |
+
model = get_model()["model"]
|
| 45 |
+
return pipe, model
|
| 46 |
|
| 47 |
@spaces.GPU(duration=12)
|
| 48 |
@torch.no_grad()
|