nielsr HF Staff commited on
Commit
739d8c3
·
verified ·
1 Parent(s): aa82404

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -1,17 +1,17 @@
1
  import gradio as gr
2
- from transformers import DPTFeatureExtractor, 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
- feature_extractor = DPTFeatureExtractor.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 = feature_extractor(image, return_tensors="pt")
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():