Update app.py
Browse files
app.py
CHANGED
|
@@ -3,9 +3,9 @@ from torch import autocast
|
|
| 3 |
from diffusers import StableDiffusionPipeline
|
| 4 |
|
| 5 |
YOUR_TOKEN="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"
|
| 6 |
-
|
| 7 |
pipe = StableDiffusionPipeline.from_pretrained("CompVis/stable-diffusion-v1-4", use_auth_token=YOUR_TOKEN, revision="fp16", torch_dtype=torch.float16)
|
| 8 |
-
pipe.to(
|
| 9 |
|
| 10 |
prompt = "a photograph of an astronaut riding a horse"
|
| 11 |
|
|
|
|
| 3 |
from diffusers import StableDiffusionPipeline
|
| 4 |
|
| 5 |
YOUR_TOKEN="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"
|
| 6 |
+
device = "cuda:0" if torch.cuda.is_available() else "cpu"
|
| 7 |
pipe = StableDiffusionPipeline.from_pretrained("CompVis/stable-diffusion-v1-4", use_auth_token=YOUR_TOKEN, revision="fp16", torch_dtype=torch.float16)
|
| 8 |
+
pipe.to(device)
|
| 9 |
|
| 10 |
prompt = "a photograph of an astronaut riding a horse"
|
| 11 |
|