ethix commited on
Commit
cc343e2
·
1 Parent(s): ec75dde

Add GPU initialization function in app_v4.py to manage model and pipeline setup

Browse files
Files changed (1) hide show
  1. app_v4.py +6 -3
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
- pipe = get_model()["pipeline"]
42
- model = get_model()["model"]
 
 
 
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()