Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
import gradio as gr
|
2 |
import torch
|
3 |
-
|
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(
|
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)
|