NourFakih commited on
Commit
bfb8082
·
verified ·
1 Parent(s): d15794f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -3,7 +3,7 @@ import os
3
  import cv2
4
  import tempfile
5
  from PIL import Image
6
- from transformers import VisionEncoderDecoderModel, ViTFeatureExtractor, AutoTokenizer, pipeline
7
  import torch
8
  import pandas as pd
9
  from nltk.corpus import wordnet
@@ -16,7 +16,8 @@ nltk.download('omw-1.4')
16
  # Load the pre-trained model for image captioning
17
  model_name = "NourFakih/Vit-GPT2-COCO2017Flickr-85k-09"
18
  model = VisionEncoderDecoderModel.from_pretrained(model_name)
19
- feature_extractor = ViTFeatureExtractor.from_pretrained(model_name)
 
20
  tokenizer = AutoTokenizer.from_pretrained(model_name)
21
 
22
 
 
3
  import cv2
4
  import tempfile
5
  from PIL import Image
6
+ from transformers import VisionEncoderDecoderModel, ViTImageProcessor, AutoTokenizer, pipeline
7
  import torch
8
  import pandas as pd
9
  from nltk.corpus import wordnet
 
16
  # Load the pre-trained model for image captioning
17
  model_name = "NourFakih/Vit-GPT2-COCO2017Flickr-85k-09"
18
  model = VisionEncoderDecoderModel.from_pretrained(model_name)
19
+ model.config.pad_token_id
20
+ feature_extractor = ViTImageProcessor.from_pretrained(model_name)
21
  tokenizer = AutoTokenizer.from_pretrained(model_name)
22
 
23