Update README.md
Browse files
README.md
CHANGED
|
@@ -25,11 +25,13 @@ def resize_with_padding(image, target_size=(224, 224)):
|
|
| 25 |
])
|
| 26 |
return transform((padded_img))
|
| 27 |
|
| 28 |
-
path="
|
| 29 |
-
img=resize_with_padding(Image.open(path))
|
| 30 |
model.eval()
|
| 31 |
with torch.no_grad():
|
| 32 |
-
|
|
|
|
| 33 |
|
| 34 |
plt.imshow(img.permute(1,2,0).detach().cpu().numpy())
|
|
|
|
| 35 |
```
|
|
|
|
| 25 |
])
|
| 26 |
return transform((padded_img))
|
| 27 |
|
| 28 |
+
path="/home/t2/Downloads/Figure_4.png"
|
| 29 |
+
img=resize_with_padding(Image.open(path).convert('RGB'))
|
| 30 |
model.eval()
|
| 31 |
with torch.no_grad():
|
| 32 |
+
ans=tokenizer.batch_decode(model.cuda().generate(img.unsqueeze(0).cuda()),skip_special_tokens=True)
|
| 33 |
+
print(ans)
|
| 34 |
|
| 35 |
plt.imshow(img.permute(1,2,0).detach().cpu().numpy())
|
| 36 |
+
plt.show()
|
| 37 |
```
|