Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,17 +1,17 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
from transformers import
|
| 3 |
import torch
|
| 4 |
import numpy as np
|
| 5 |
from PIL import Image
|
| 6 |
|
| 7 |
torch.hub.download_url_to_file('http://images.cocodataset.org/val2017/000000039769.jpg', 'cats.jpg')
|
| 8 |
|
| 9 |
-
|
| 10 |
model = DPTForDepthEstimation.from_pretrained("Intel/dpt-large")
|
| 11 |
|
| 12 |
def process_image(image):
|
| 13 |
# prepare image for the model
|
| 14 |
-
encoding =
|
| 15 |
|
| 16 |
# forward pass
|
| 17 |
with torch.no_grad():
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
from transformers import DPTImageProcessor, DPTForDepthEstimation
|
| 3 |
import torch
|
| 4 |
import numpy as np
|
| 5 |
from PIL import Image
|
| 6 |
|
| 7 |
torch.hub.download_url_to_file('http://images.cocodataset.org/val2017/000000039769.jpg', 'cats.jpg')
|
| 8 |
|
| 9 |
+
processor = DPTImageProcessor.from_pretrained("Intel/dpt-large")
|
| 10 |
model = DPTForDepthEstimation.from_pretrained("Intel/dpt-large")
|
| 11 |
|
| 12 |
def process_image(image):
|
| 13 |
# prepare image for the model
|
| 14 |
+
encoding = processor(image, return_tensors="pt")
|
| 15 |
|
| 16 |
# forward pass
|
| 17 |
with torch.no_grad():
|