Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -7,11 +7,11 @@ import csv
|
|
7 |
from PIL import Image
|
8 |
|
9 |
device = 'cpu'
|
10 |
-
|
11 |
# Load the pretrained model, feature extractor, and tokenizer
|
12 |
-
model = VisionEncoderDecoderModel.from_pretrained(
|
13 |
-
feature_extractor = ViTImageProcessor.from_pretrained(
|
14 |
-
tokenizer = AutoTokenizer.from_pretrained(
|
15 |
|
16 |
def predict(image, max_length=64, num_beams=4):
|
17 |
# Process the input image
|
|
|
7 |
from PIL import Image
|
8 |
|
9 |
device = 'cpu'
|
10 |
+
model_name="NourFakih/Vit-GPT2-COCO2017Flickr-40k-04"
|
11 |
# Load the pretrained model, feature extractor, and tokenizer
|
12 |
+
model = VisionEncoderDecoderModel.from_pretrained(model_name).to(device)
|
13 |
+
feature_extractor = ViTImageProcessor.from_pretrained(model_name)
|
14 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
15 |
|
16 |
def predict(image, max_length=64, num_beams=4):
|
17 |
# Process the input image
|