update app.py file
Browse files
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 |
-
|
22 |
-
|
23 |
with torch.no_grad():
|
24 |
-
outputs = model(**
|
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]]
|