Spaces:
Running
on
L4
Running
on
L4
Upload app.py
Browse files
app.py
CHANGED
|
@@ -57,7 +57,8 @@ def create_depth_demo(model, device):
|
|
| 57 |
image = torch.nn.functional.interpolate(image, (440,480), mode='bilinear', align_corners=True)
|
| 58 |
image = F.pad(image, (0, 0, 40, 0))
|
| 59 |
with torch.no_grad():
|
| 60 |
-
pred = model(image)['pred_d']
|
|
|
|
| 61 |
|
| 62 |
pred = pred[:,:,40:,:]
|
| 63 |
pred = torch.nn.functional.interpolate(pred, shape[2:], mode='bilinear', align_corners=True)
|
|
@@ -88,6 +89,7 @@ def create_refseg_demo(model, tokenizer, device):
|
|
| 88 |
image_t = transforms.Normalize(mean=[0.5, 0.5, 0.5], std=[0.5, 0.5, 0.5])(image_t)
|
| 89 |
shape = image_t.shape
|
| 90 |
image_t = torch.nn.functional.interpolate(image_t, (512,512), mode='bilinear', align_corners=True)
|
|
|
|
| 91 |
input_ids = tokenizer(text=text, truncation=True, max_length=40, return_length=True,
|
| 92 |
return_overflowing_tokens=False, padding="max_length", return_tensors="pt")['input_ids'].to(device)
|
| 93 |
|
|
|
|
| 57 |
image = torch.nn.functional.interpolate(image, (440,480), mode='bilinear', align_corners=True)
|
| 58 |
image = F.pad(image, (0, 0, 40, 0))
|
| 59 |
with torch.no_grad():
|
| 60 |
+
pred = model(image)#['pred_d']
|
| 61 |
+
print('!!!', pred.keys())
|
| 62 |
|
| 63 |
pred = pred[:,:,40:,:]
|
| 64 |
pred = torch.nn.functional.interpolate(pred, shape[2:], mode='bilinear', align_corners=True)
|
|
|
|
| 89 |
image_t = transforms.Normalize(mean=[0.5, 0.5, 0.5], std=[0.5, 0.5, 0.5])(image_t)
|
| 90 |
shape = image_t.shape
|
| 91 |
image_t = torch.nn.functional.interpolate(image_t, (512,512), mode='bilinear', align_corners=True)
|
| 92 |
+
print('!!!', text)
|
| 93 |
input_ids = tokenizer(text=text, truncation=True, max_length=40, return_length=True,
|
| 94 |
return_overflowing_tokens=False, padding="max_length", return_tensors="pt")['input_ids'].to(device)
|
| 95 |
|