Spaces:
Runtime error
Runtime error
Without GPU
Browse files
app.py
CHANGED
@@ -11,7 +11,7 @@ nltk.download('stopwords')
|
|
11 |
|
12 |
# load the model and tokenizer
|
13 |
processor = BlipProcessor.from_pretrained("Salesforce/blip-image-captioning-base")
|
14 |
-
model = BlipForConditionalGeneration.from_pretrained("Salesforce/blip-image-captioning-base")
|
15 |
|
16 |
tokenizer = AutoTokenizer.from_pretrained("nlpconnect/vit-gpt2-image-captioning")
|
17 |
reader = easyocr.Reader(['en'])
|
@@ -24,7 +24,7 @@ def generate_hashtags(image_file):
|
|
24 |
image = Image.open(image_file).convert('RGB')
|
25 |
|
26 |
# extract image features
|
27 |
-
inputs = processor(image, return_tensors="pt")
|
28 |
|
29 |
output_ids = model.generate(**inputs)
|
30 |
# out_text = processor.decode(out[0], skip_special_tokens=True)
|
|
|
11 |
|
12 |
# load the model and tokenizer
|
13 |
processor = BlipProcessor.from_pretrained("Salesforce/blip-image-captioning-base")
|
14 |
+
model = BlipForConditionalGeneration.from_pretrained("Salesforce/blip-image-captioning-base")
|
15 |
|
16 |
tokenizer = AutoTokenizer.from_pretrained("nlpconnect/vit-gpt2-image-captioning")
|
17 |
reader = easyocr.Reader(['en'])
|
|
|
24 |
image = Image.open(image_file).convert('RGB')
|
25 |
|
26 |
# extract image features
|
27 |
+
inputs = processor(image, return_tensors="pt")
|
28 |
|
29 |
output_ids = model.generate(**inputs)
|
30 |
# out_text = processor.decode(out[0], skip_special_tokens=True)
|