Instantiate a pipeline from a checkpoint on the Hugging Face Hub: | |
from transformers import pipeline | |
checkpoint = "vinvino02/glpn-nyu" | |
depth_estimator = pipeline("depth-estimation", model=checkpoint) | |
Next, choose an image to analyze: | |
from PIL import Image | |
import requests | |
url = "https://unsplash.com/photos/HwBAsSbPBDU/download?ixid=MnwxMjA3fDB8MXxzZWFyY2h8MzR8fGNhciUyMGluJTIwdGhlJTIwc3RyZWV0fGVufDB8MHx8fDE2Nzg5MDEwODg&force=true&w=640" | |
image = Image.open(requests.get(url, stream=True).raw) | |
image | |
Pass the image to the pipeline. |