Ghamryy commited on
Commit
7c3695e
1 Parent(s): ef75de5

trying to clear cuda cache after each generation

Browse files
Files changed (1) hide show
  1. app.py +1 -0
app.py CHANGED
@@ -14,6 +14,7 @@ base = DiffusionPipeline.from_pretrained(
14
  base.to("cuda")
15
 
16
  def text2Image(prompt, steps=50, scale=7, Width=1024, Height=1024):
 
17
  image = base(prompt, num_inference_steps=steps, guidance_scale=scale,
18
  width=Width, height=Height, cross_attention_kwargs={"scale": 1}).images[0]
19
  return image
 
14
  base.to("cuda")
15
 
16
  def text2Image(prompt, steps=50, scale=7, Width=1024, Height=1024):
17
+ torch.cuda.empty_cache()
18
  image = base(prompt, num_inference_steps=steps, guidance_scale=scale,
19
  width=Width, height=Height, cross_attention_kwargs={"scale": 1}).images[0]
20
  return image