Update README.md
Browse files
README.md
CHANGED
@@ -65,16 +65,16 @@ import numpy as np
|
|
65 |
import requests
|
66 |
import torch
|
67 |
|
68 |
-
from transformers import
|
69 |
|
|
|
70 |
model = DPTForDepthEstimation.from_pretrained("Intel/dpt-hybrid-midas", low_cpu_mem_usage=True)
|
71 |
-
feature_extractor = DPTFeatureExtractor.from_pretrained("Intel/dpt-hybrid-midas")
|
72 |
|
73 |
url = "http://images.cocodataset.org/val2017/000000039769.jpg"
|
74 |
image = Image.open(requests.get(url, stream=True).raw)
|
75 |
|
76 |
# prepare image for the model
|
77 |
-
inputs =
|
78 |
|
79 |
with torch.no_grad():
|
80 |
outputs = model(**inputs)
|
|
|
65 |
import requests
|
66 |
import torch
|
67 |
|
68 |
+
from transformers import DPTImageProcessor, DPTForDepthEstimation
|
69 |
|
70 |
+
image_processor = DPTImageProcessor.from_pretrained("Intel/dpt-hybrid-midas")
|
71 |
model = DPTForDepthEstimation.from_pretrained("Intel/dpt-hybrid-midas", low_cpu_mem_usage=True)
|
|
|
72 |
|
73 |
url = "http://images.cocodataset.org/val2017/000000039769.jpg"
|
74 |
image = Image.open(requests.get(url, stream=True).raw)
|
75 |
|
76 |
# prepare image for the model
|
77 |
+
inputs = image_processor(images=image, return_tensors="pt")
|
78 |
|
79 |
with torch.no_grad():
|
80 |
outputs = model(**inputs)
|