radhika-minion02 commited on
Commit
db79ba5
1 Parent(s): b9d83c9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -13,8 +13,8 @@ pipe = StableDiffusionPipeline.from_pretrained(model_path, torch_dtype=torch.flo
13
  # Change Scheduler to DDIMScheduler
14
  pipe.scheduler = DDIMScheduler.from_config(pipe.scheduler.config)
15
 
16
- # For memory optimization
17
- pipe.enable_xformers_memory_efficient_attention()
18
 
19
  # Generate the image from the given text prompt
20
  def generate_response(prompt):
@@ -30,7 +30,7 @@ def generate_response(prompt):
30
  width = 512
31
 
32
  seed = random.randint(0, 2147483647)
33
- generator = torch.Generator(device='cuda').manual_seed(seed)
34
 
35
  with torch.inference_mode():
36
  imgs = pipe(
 
13
  # Change Scheduler to DDIMScheduler
14
  pipe.scheduler = DDIMScheduler.from_config(pipe.scheduler.config)
15
 
16
+ # For memory optimization -- only for GPU
17
+ # pipe.enable_xformers_memory_efficient_attention()
18
 
19
  # Generate the image from the given text prompt
20
  def generate_response(prompt):
 
30
  width = 512
31
 
32
  seed = random.randint(0, 2147483647)
33
+ generator = torch.Generator(device='cpu').manual_seed(seed)
34
 
35
  with torch.inference_mode():
36
  imgs = pipe(