Skip to content

Commit c717498

Browse files
committed
use image url
1 parent 1b4a43f commit c717498

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

docs/source/en/api/models/autoencoder_rae.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,15 @@ model = AutoencoderRAE.from_pretrained(
4242
```python
4343
import torch
4444
from diffusers import AutoencoderRAE
45-
from PIL import Image
45+
from diffusers.utils import load_image
4646
from torchvision.transforms.functional import to_tensor, to_pil_image
4747

4848
model = AutoencoderRAE.from_pretrained(
4949
"nyu-visionx/RAE-dinov2-wReg-base-ViTXL-n08"
5050
).to("cuda").eval()
5151

52-
image = Image.open("cat.png").convert("RGB").resize((224, 224))
52+
image = load_image("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/cat.png")
53+
image = image.convert("RGB").resize((224, 224))
5354
x = to_tensor(image).unsqueeze(0).to("cuda") # (1, 3, 224, 224), values in [0, 1]
5455

5556
with torch.no_grad():

0 commit comments

Comments
 (0)