Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
-
from transformers import
|
2 |
-
|
3 |
from PIL import Image
|
4 |
|
5 |
-
model =
|
6 |
-
feature_extractor =
|
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")
|