vama09 commited on
Commit
9fc3708
1 Parent(s): 394f7d1

Without GPU

Browse files
Files changed (1) hide show
  1. app.py +2 -2
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").to("cuda")
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").to("cuda")
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)