fffiloni commited on
Commit
6df9bf7
1 Parent(s): 07eca81

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -1,6 +1,6 @@
1
  import gradio as gr
2
  import torch
3
- import requests
4
  from PIL import Image
5
  from transformers import BlipProcessor, BlipForConditionalGeneration
6
 
@@ -9,7 +9,7 @@ model = BlipForConditionalGeneration.from_pretrained("Salesforce/blip-image-capt
9
 
10
  def infer(image_input):
11
  #img_url = 'https://storage.googleapis.com/sfr-vision-language-research/BLIP/demo.jpg'
12
- raw_image = Image.open(requests.get(image_input, stream=True).raw).convert('RGB')
13
 
14
  # unconditional image captioning
15
  inputs = processor(raw_image, return_tensors="pt").to("cuda", torch.float16)
 
1
  import gradio as gr
2
  import torch
3
+
4
  from PIL import Image
5
  from transformers import BlipProcessor, BlipForConditionalGeneration
6
 
 
9
 
10
  def infer(image_input):
11
  #img_url = 'https://storage.googleapis.com/sfr-vision-language-research/BLIP/demo.jpg'
12
+ raw_image = Image.open(image_input).convert('RGB')
13
 
14
  # unconditional image captioning
15
  inputs = processor(raw_image, return_tensors="pt").to("cuda", torch.float16)