hatmanstack commited on
Commit
228ed52
·
1 Parent(s): 164e1f6
Files changed (1) hide show
  1. app.py +5 -0
app.py CHANGED
@@ -4,6 +4,7 @@ import random
4
  import gradio as gr
5
  from diffusers import AutoPipelineForText2Image
6
  from diffusers.utils import load_image
 
7
 
8
  device = "cuda" if torch.cuda.is_available() else "cpu"
9
  dtype = torch.float16 if torch.cuda.is_available() else torch.float32
@@ -56,10 +57,14 @@ def create_image(image_pil,
56
  generator=generator,
57
  ).images[0]
58
 
 
 
 
59
 
60
  return image
61
 
62
 
 
63
 
64
  # Description
65
  title = r"""
 
4
  import gradio as gr
5
  from diffusers import AutoPipelineForText2Image
6
  from diffusers.utils import load_image
7
+ import gc
8
 
9
  device = "cuda" if torch.cuda.is_available() else "cpu"
10
  dtype = torch.float16 if torch.cuda.is_available() else torch.float32
 
57
  generator=generator,
58
  ).images[0]
59
 
60
+ if torch.cuda.is_available():
61
+ torch.cuda.empty_cache()
62
+ gc.collect()
63
 
64
  return image
65
 
66
 
67
+
68
 
69
  # Description
70
  title = r"""