EndlessSora commited on
Commit
461c51a
·
verified ·
1 Parent(s): 03ece6e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -19,6 +19,7 @@ import huggingface_hub
19
  import pillow_avif
20
  import spaces
21
  import torch
 
22
  from huggingface_hub import snapshot_download
23
  from pillow_heif import register_heif_opener
24
 
@@ -75,7 +76,11 @@ def prepare_pipeline(model_version, enable_realism, enable_anti_blur):
75
  pipeline = loaded_pipeline_config['pipeline']
76
  if pipeline is None or pipeline.model_version != model_version:
77
  del loaded_pipeline_config['pipeline']
78
-
 
 
 
 
79
  model_path = f'./models/InfiniteYou/infu_flux_v1.0/{model_version}'
80
  print(f'loading model from {model_path}')
81
 
 
19
  import pillow_avif
20
  import spaces
21
  import torch
22
+ import gc
23
  from huggingface_hub import snapshot_download
24
  from pillow_heif import register_heif_opener
25
 
 
76
  pipeline = loaded_pipeline_config['pipeline']
77
  if pipeline is None or pipeline.model_version != model_version:
78
  del loaded_pipeline_config['pipeline']
79
+ del pipeline
80
+
81
+ gc.collect()
82
+ torch.cuda.empty_cache()
83
+
84
  model_path = f'./models/InfiniteYou/infu_flux_v1.0/{model_version}'
85
  print(f'loading model from {model_path}')
86