abdulsamad commited on
Commit
3f484f6
·
1 Parent(s): 0d55045

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -29,14 +29,14 @@ model = BlipForConditionalGeneration.from_pretrained("Salesforce/blip-image-capt
29
  #gr.Textbox(os.environ['HF_TOKENS'])
30
 
31
  #Image-to-text endpoint
32
- def get_completion(image):
33
- raw_image = Image.open(image).convert('RGB')
34
 
35
  text = "a photography of"
36
  inputs = processor(raw_image, text, return_tensors="pt")
37
 
38
  out = model.generate(**inputs)
39
- return json.loads(processor.decode(out[0], skip_special_tokens=True))
40
 
41
 
42
  # headers = {
 
29
  #gr.Textbox(os.environ['HF_TOKENS'])
30
 
31
  #Image-to-text endpoint
32
+ def get_completion(raw_image):
33
+ #raw_image = Image.open(image).convert('RGB')
34
 
35
  text = "a photography of"
36
  inputs = processor(raw_image, text, return_tensors="pt")
37
 
38
  out = model.generate(**inputs)
39
+ return processor.decode(out[0], skip_special_tokens=True)
40
 
41
 
42
  # headers = {