wangsssssss commited on
Commit
3f7113b
·
verified ·
1 Parent(s): c767337

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -40,11 +40,13 @@ class Pipeline:
40
  self.denoiser = denoiser.cuda()
41
  self.conditioner = conditioner.cuda()
42
  self.resolution = resolution
43
- self.tmp_dir = tempfile.TemporaryDirectory(prefix="traj_gifs_")
 
 
 
 
44
  # self.denoiser.compile()
45
 
46
- def __del__(self):
47
- self.tmp_dir.cleanup()
48
 
49
  @spaces.GPU(duration=5)
50
  @torch.no_grad()
 
40
  self.denoiser = denoiser.cuda()
41
  self.conditioner = conditioner.cuda()
42
  self.resolution = resolution
43
+ self.tmp_dir = "./traj_gifs_"
44
+
45
+ # 若文件夹已存在,先删除旧文件(可选,根据需求决定)
46
+ if os.path.exists(self.tmp_dir):
47
+ shutil.rmtree(self.tmp_dir) # 递归删除文件夹及内容
48
  # self.denoiser.compile()
49
 
 
 
50
 
51
  @spaces.GPU(duration=5)
52
  @torch.no_grad()