Skip to content

Commit

Permalink
fixed apple silicon structure
Browse files Browse the repository at this point in the history
  • Loading branch information
4bdul4ziz committed Jan 28, 2023
1 parent cab0eed commit f53c557
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,14 @@
beta_schedule="scaled_linear"
)

modelid = "CompVis/stable-diffusion-v1-4"
device = "cpu"
pipe = StableDiffusionPipeline.from_pretrained(
"CompVis/stable-diffusion-v1-4",
scheduler=lms,
use_auth_token=auth_token,
from_tf=True,
cache_dir=os.getenv("cache_dir", "./models")
).to(device)
pipe = StableDiffusionPipeline.from_pretrained("runwayml/stable-diffusion-v1-5")
pipe = pipe.to("mps")
pipe.enable_attention_slicing()


def generate():
with autocast(device):
image = pipe(prompt.get(), guidance_scale=9)["sample"][0]
_ = pipe(prompt.get(), num_inference_steps=1)
image = pipe(prompt).images[0]
image.save('generated.png')
img = ImageTk.PhotoImage(image)
lmain.configure(image=img)
Expand Down

0 comments on commit f53c557

Please sign in to comment.