add how to use with diffusers to readme

#5
by akhaliq HF staff - opened
Files changed (1) hide show
  1. README.md +18 -0
README.md CHANGED
@@ -14,6 +14,24 @@ Use prompt: 'mdjrny-v4 style'
14
 
15
  [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1vkuxKKeSYNYI2OLZm8mR-WqcokQtSURM?usp=sharing)
16
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  ### Stable Diffusion v1.5 vs Midjourney v4 Diffusion
18
  (Same parameters, just added "mdjrny-v4 style" at the beginning):
19
  <img src="https://s3.amazonaws.com/moonup/production/uploads/1667904587642-63265d019f9d19bfd4f45031.png" width="100%"/>
14
 
15
  [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1vkuxKKeSYNYI2OLZm8mR-WqcokQtSURM?usp=sharing)
16
 
17
+ ### 🧨 Diffusers
18
+
19
+ This model can be used just like any other Stable Diffusion model. For more information,
20
+ please have a look at the [Stable Diffusion](https://huggingface.co/docs/diffusers/api/pipelines/stable_diffusion).
21
+
22
+ 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]().
23
+
24
+ ```python
25
+ from diffusers import StableDiffusionPipeline
26
+ import torch
27
+ model_id = "prompthero/midjourney-v4-diffusion"
28
+ pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
29
+ pipe = pipe.to("cuda")
30
+ prompt = "mdjrny-v4 cars"
31
+ image = pipe(prompt).images[0]
32
+ image.save("./cars.png")
33
+ ```
34
+
35
  ### Stable Diffusion v1.5 vs Midjourney v4 Diffusion
36
  (Same parameters, just added "mdjrny-v4 style" at the beginning):
37
  <img src="https://s3.amazonaws.com/moonup/production/uploads/1667904587642-63265d019f9d19bfd4f45031.png" width="100%"/>