Add diffusers code example
#2
by
patrickvonplaten
- opened
README.md
CHANGED
|
@@ -8,6 +8,28 @@ Use the tokens **_spiderverse style_** in your prompts for the effect.
|
|
| 8 |
|
| 9 |
If you enjoy this model, please check out my other models on [Huggingface](https://huggingface.co/nitrosocke)
|
| 10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
**Portraits rendered with the model:**
|
| 12 |

|
| 13 |
**Sample images used for training:**
|
|
|
|
| 8 |
|
| 9 |
If you enjoy this model, please check out my other models on [Huggingface](https://huggingface.co/nitrosocke)
|
| 10 |
|
| 11 |
+
### 🧨 Diffusers
|
| 12 |
+
|
| 13 |
+
This model can be used just like any other Stable Diffusion model. For more information,
|
| 14 |
+
please have a look at the [Stable Diffusion](https://huggingface.co/docs/diffusers/api/pipelines/stable_diffusion).
|
| 15 |
+
|
| 16 |
+
You can also export the model to [ONNX](https://huggingface.co/docs/diffusers/optimization/onnx), [MPS](https://huggingface.co/docs/diffusers/optimization/mps) and/or [FLAX/JAX]().
|
| 17 |
+
|
| 18 |
+
```python
|
| 19 |
+
#!pip install diffusers transformers scipy torch
|
| 20 |
+
from diffusers import StableDiffusionPipeline
|
| 21 |
+
import torch
|
| 22 |
+
|
| 23 |
+
model_id = "nitrosocke/spider-verse-diffusion"
|
| 24 |
+
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
|
| 25 |
+
pipe = pipe.to("cuda")
|
| 26 |
+
|
| 27 |
+
prompt = "a magical princess with golden hair, spiderverse style"
|
| 28 |
+
image = pipe(prompt).images[0]
|
| 29 |
+
|
| 30 |
+
image.save("./magical_princess.png")
|
| 31 |
+
```
|
| 32 |
+
|
| 33 |
**Portraits rendered with the model:**
|
| 34 |

|
| 35 |
**Sample images used for training:**
|