Fix example
Browse files
README.md
CHANGED
@@ -16,18 +16,21 @@ This repo contains ONNX model files for [madebyollin's Tiny AutoEncoder for Stab
|
|
16 |
To install the requirements for this demo, do pip install optimum["onnxruntime"].
|
17 |
|
18 |
```python
|
|
|
|
|
19 |
from optimum.onnxruntime import ORTStableDiffusionPipeline
|
20 |
|
21 |
model_id = "CompVis/stable-diffusion-v1-4"
|
22 |
-
pipeline = ORTStableDiffusionPipeline.from_pretrained(model_id, revision="onnx")
|
23 |
|
24 |
-
|
25 |
|
26 |
-
|
27 |
-
|
28 |
-
|
|
|
|
|
29 |
|
30 |
prompt = "sailing ship in storm by Leonardo da Vinci"
|
31 |
image = pipeline(prompt).images[0]
|
32 |
-
|
33 |
```
|
|
|
16 |
To install the requirements for this demo, do pip install optimum["onnxruntime"].
|
17 |
|
18 |
```python
|
19 |
+
from huggingface_hub import snapshot_download
|
20 |
+
from diffusers.pipelines import OnnxRuntimeModel
|
21 |
from optimum.onnxruntime import ORTStableDiffusionPipeline
|
22 |
|
23 |
model_id = "CompVis/stable-diffusion-v1-4"
|
|
|
24 |
|
25 |
+
taesd_dir = snapshot_download(repo_id="deinferno/taesd-onnx")
|
26 |
|
27 |
+
pipeline = ORTStableDiffusionPipeline.from_pretrained(
|
28 |
+
model_id,
|
29 |
+
vae_decoder_session = OnnxRuntimeModel.from_pretrained(f"{taesd_dir}/vae_decoder"),
|
30 |
+
vae_encoder_session = OnnxRuntimeModel.from_pretrained(f"{taesd_dir}/vae_encoder"),
|
31 |
+
revision="onnx")
|
32 |
|
33 |
prompt = "sailing ship in storm by Leonardo da Vinci"
|
34 |
image = pipeline(prompt).images[0]
|
35 |
+
image.save("result.png")
|
36 |
```
|