Spaces:
Sleeping
Sleeping
bharathj16
commited on
Commit
•
c67987a
1
Parent(s):
7ec4116
Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
from transformers import
|
2 |
import torch
|
3 |
import numpy as np
|
4 |
from PIL import Image
|
@@ -7,11 +7,11 @@ import requests
|
|
7 |
url = "http://images.cocodataset.org/val2017/000000039769.jpg"
|
8 |
image = Image.open(requests.get(url, stream=True).raw)
|
9 |
|
10 |
-
|
11 |
-
model = DPTForDepthEstimation.from_pretrained("
|
12 |
|
13 |
# prepare image for the model
|
14 |
-
inputs =
|
15 |
|
16 |
with torch.no_grad():
|
17 |
outputs = model(**inputs)
|
|
|
1 |
+
from transformers import AutoImageProcessor, DPTForDepthEstimation
|
2 |
import torch
|
3 |
import numpy as np
|
4 |
from PIL import Image
|
|
|
7 |
url = "http://images.cocodataset.org/val2017/000000039769.jpg"
|
8 |
image = Image.open(requests.get(url, stream=True).raw)
|
9 |
|
10 |
+
image_processor = AutoImageProcessor.from_pretrained("facebook/dpt-dinov2-small-nyu")
|
11 |
+
model = DPTForDepthEstimation.from_pretrained("facebook/dpt-dinov2-small-nyu")
|
12 |
|
13 |
# prepare image for the model
|
14 |
+
inputs = image_processor(images=image, return_tensors="pt")
|
15 |
|
16 |
with torch.no_grad():
|
17 |
outputs = model(**inputs)
|