Commit
·
82b5728
1
Parent(s):
4e872f5
device integration
Browse files
app.py
CHANGED
@@ -4,9 +4,10 @@ import torch
|
|
4 |
|
5 |
model_id = "stabilityai/stable-diffusion-2"
|
6 |
scheduler = EulerDiscreteScheduler.from_pretrained(model_id, subfolder="scheduler")
|
|
|
7 |
|
8 |
pipe = StableDiffusionPipeline.from_pretrained(model_id, scheduler=scheduler, revision="fp16")
|
9 |
-
pipe = pipe.to(
|
10 |
|
11 |
def txt2img(prompt):
|
12 |
image = pipe(prompt, height=768, width=768, guidance_scale = 10).images[0]
|
|
|
4 |
|
5 |
model_id = "stabilityai/stable-diffusion-2"
|
6 |
scheduler = EulerDiscreteScheduler.from_pretrained(model_id, subfolder="scheduler")
|
7 |
+
device = troch.device("cuda" if torch.cuda.is_avaliable() else "cpu")
|
8 |
|
9 |
pipe = StableDiffusionPipeline.from_pretrained(model_id, scheduler=scheduler, revision="fp16")
|
10 |
+
pipe = pipe.to(device)
|
11 |
|
12 |
def txt2img(prompt):
|
13 |
image = pipe(prompt, height=768, width=768, guidance_scale = 10).images[0]
|