Nepjune commited on
Commit
ec665e5
·
verified ·
1 Parent(s): dfaaaf9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -1,9 +1,9 @@
1
- from transformers import VisionEncoderDecoderModel, ViTImageProcessor, AutoTokenizer
2
- # import torch
3
  from PIL import Image
4
 
5
- model = VisionEncoderDecoderModel.from_pretrained("nlpconnect/vit-gpt2-image-captioning")
6
- feature_extractor = ViTImageProcessor.from_pretrained("nlpconnect/vit-gpt2-image-captioning")
7
  tokenizer = AutoTokenizer.from_pretrained("nlpconnect/vit-gpt2-image-captioning")
8
 
9
  device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
 
1
+ from transformers import ViTFeatureExtractor, ViTForImageCaptioning, AutoTokenizer
2
+ import torch
3
  from PIL import Image
4
 
5
+ model = ViTForImageCaptioning.from_pretrained("nlpconnect/vit-gpt2-image-captioning")
6
+ feature_extractor = ViTFeatureExtractor.from_pretrained("nlpconnect/vit-gpt2-image-captioning")
7
  tokenizer = AutoTokenizer.from_pretrained("nlpconnect/vit-gpt2-image-captioning")
8
 
9
  device = torch.device("cuda" if torch.cuda.is_available() else "cpu")