Update README.md
Browse files
README.md
CHANGED
|
@@ -3,16 +3,23 @@ license: creativeml-openrail-m
|
|
| 3 |
tags:
|
| 4 |
- stable-diffusion
|
| 5 |
- stable-diffusion-diffusers
|
| 6 |
-
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
tags:
|
| 4 |
- stable-diffusion
|
| 5 |
- stable-diffusion-diffusers
|
| 6 |
+
- text-to-image
|
| 7 |
+
inference: true
|
| 8 |
+
|
| 9 |
+
---
|
| 10 |
+
|
| 11 |
+
### Diffusers
|
| 12 |
+
```py
|
| 13 |
+
from diffusers import StableDiffusionPipeline
|
| 14 |
+
import torch
|
| 15 |
+
|
| 16 |
+
model_id = "runwayml/stable-diffusion-v1-5"
|
| 17 |
+
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16, revision="fp16")
|
| 18 |
+
pipe = pipe.to("cuda")
|
| 19 |
+
|
| 20 |
+
prompt = "a photo of an astronaut riding a horse on mars"
|
| 21 |
+
image = pipe(prompt).images[0]
|
| 22 |
+
|
| 23 |
+
image.save("astronaut_rides_horse.png")
|
| 24 |
+
```
|
| 25 |
+
For more detailed instructions, use-cases and examples in JAX follow the instructions [here](https://github.com/huggingface/diffusers#text-to-image-generation-with-stable-diffusion)
|