sna89 commited on
Commit
dbf9317
·
1 Parent(s): aba5ffb

update app.py file

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -18,10 +18,10 @@ device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
18
  model = model.to(device)
19
 
20
  def segment_image(img):
21
- img = processor(img, return_tensors="pt")
22
- img = img.to(device)
23
  with torch.no_grad():
24
- outputs = model(**img)
25
 
26
  predicted_semantic_map = processor.post_process_semantic_segmentation(
27
  outputs, target_sizes=[img.size[::-1]]
 
18
  model = model.to(device)
19
 
20
  def segment_image(img):
21
+ img_pt = processor(img, return_tensors="pt")
22
+ img_pt = img_pt.to(device)
23
  with torch.no_grad():
24
+ outputs = model(**img_pt)
25
 
26
  predicted_semantic_map = processor.post_process_semantic_segmentation(
27
  outputs, target_sizes=[img.size[::-1]]