apolinario commited on
Commit
dec3828
1 Parent(s): 34f173c

Clear cache attempt

Browse files
Files changed (1) hide show
  1. app.py +6 -0
app.py CHANGED
@@ -42,6 +42,7 @@ from random import randint
42
  from pathvalidate import sanitize_filename
43
  from huggingface_hub import hf_hub_download
44
  import shortuuid
 
45
 
46
  device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
47
  print("Using device:", device)
@@ -76,7 +77,12 @@ perceptor = (
76
  .requires_grad_(False)
77
  .to(device)
78
  )
 
 
 
79
  def run_all(user_input, width, height, template, num_steps, flavor):
 
 
80
  import random
81
  #if uploaded_file is not None:
82
  #uploaded_folder = f"{DefaultPaths.root_path}/uploaded"
 
42
  from pathvalidate import sanitize_filename
43
  from huggingface_hub import hf_hub_download
44
  import shortuuid
45
+ import gc
46
 
47
  device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
48
  print("Using device:", device)
 
77
  .requires_grad_(False)
78
  .to(device)
79
  )
80
+ gc.collect()
81
+ torch.cuda.empty_cache()
82
+
83
  def run_all(user_input, width, height, template, num_steps, flavor):
84
+ gc.collect()
85
+ torch.cuda.empty_cache()
86
  import random
87
  #if uploaded_file is not None:
88
  #uploaded_folder = f"{DefaultPaths.root_path}/uploaded"