biubiubiiu commited on
Commit
d54f4b1
·
1 Parent(s): 4efae7a
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -82,8 +82,9 @@ def style_transfer(content, style, style_type, alpha, keep_resolution):
82
  output = decoder(feat).cpu().squeeze(0).clamp_(0, 1)
83
  output = transforms.ToPILImage()(output)
84
 
85
- torch.cuda.ipc_collect()
86
- torch.cuda.empty_cache()
 
87
 
88
  return output
89
 
 
82
  output = decoder(feat).cpu().squeeze(0).clamp_(0, 1)
83
  output = transforms.ToPILImage()(output)
84
 
85
+ if torch.cuda.is_available():
86
+ torch.cuda.ipc_collect()
87
+ torch.cuda.empty_cache()
88
 
89
  return output
90