JoPmt commited on
Commit
333c77e
1 Parent(s): ac4cdd6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -11,14 +11,18 @@ import numpy as np
11
  from accelerate import Accelerator
12
  accelerator = Accelerator(cpu=True)
13
  pipe = accelerator.prepare(AmusedPipeline.from_pretrained("amused/amused-512", variant=None, torch_dtype=torch.float32, use_safetensors=True))
14
- pipe = accelerator.prepare(pipe.vqvae.to(torch.float32, memory_format=torch.channels_last))
15
  pipe = pipe.to("cpu")
16
  apol=[]
17
  def plex(prompt, fifth, twice):
18
  gc.collect()
19
  apol=[]
20
  prompt = prompt
21
- image = pipe([prompt]*fifth, num_inference_steps=twice)
 
 
 
 
22
  for a, imze in enumerate(image["images"]):
23
  apol.append(imze)
24
  return apol
 
11
  from accelerate import Accelerator
12
  accelerator = Accelerator(cpu=True)
13
  pipe = accelerator.prepare(AmusedPipeline.from_pretrained("amused/amused-512", variant=None, torch_dtype=torch.float32, use_safetensors=True))
14
+ pipe = accelerator.prepare(pipe.vqvae.to(torch.float32))
15
  pipe = pipe.to("cpu")
16
  apol=[]
17
  def plex(prompt, fifth, twice):
18
  gc.collect()
19
  apol=[]
20
  prompt = prompt
21
+ nm = random.randint(1, 4836928)
22
+ while nm % 32 != 0:
23
+ nm = random.randint(1, 4836928)
24
+ generator = torch.Generator(device="cpu").manual_seed(nm)
25
+ image = pipe([prompt]*fifth, generator=generator,num_inference_steps=twice)
26
  for a, imze in enumerate(image["images"]):
27
  apol.append(imze)
28
  return apol