Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -14,7 +14,7 @@ model_trained.load_state_dict(torch.load('model_trained.pth',map_location=torch.
|
|
14 |
image_processor = ViTImageProcessor.from_pretrained("nlpconnect/vit-gpt2-image-captioning")
|
15 |
tokenizer = GPT2TokenizerFast.from_pretrained("nlpconnect/vit-gpt2-image-captioning")
|
16 |
|
17 |
-
def show_n_generate(img, greedy = True
|
18 |
image = Image.open(img)
|
19 |
pixel_values = image_processor(image, return_tensors ="pt").pixel_values
|
20 |
plt.imshow(np.asarray(image))
|
|
|
14 |
image_processor = ViTImageProcessor.from_pretrained("nlpconnect/vit-gpt2-image-captioning")
|
15 |
tokenizer = GPT2TokenizerFast.from_pretrained("nlpconnect/vit-gpt2-image-captioning")
|
16 |
|
17 |
+
def show_n_generate(img, model, greedy = True):
|
18 |
image = Image.open(img)
|
19 |
pixel_values = image_processor(image, return_tensors ="pt").pixel_values
|
20 |
plt.imshow(np.asarray(image))
|