import requests from PIL import Image from io import BytesIO url = 'https://datasets-server.huggingface.co/assets/imagenet-1k/--/default/test/12/image/image.jpg' image = Image.open(requests.get(url, stream=True).raw) image