Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -13,6 +13,8 @@ import torchvision
|
|
13 |
from torchvision.transforms import CenterCrop, ConvertImageDtype, Normalize, Resize
|
14 |
from torchvision.transforms.functional import InterpolationMode
|
15 |
from torchvision import transforms
|
|
|
|
|
16 |
|
17 |
from transformers import CLIPModel, AutoModel
|
18 |
from huggingface_hub import hf_hub_download
|
@@ -130,7 +132,7 @@ image_processor = AutoImageProcessor.from_pretrained("openai/clip-vit-base-patch
|
|
130 |
def predict_sentiment(text, image):
|
131 |
print(text, image)
|
132 |
print(dir(image))
|
133 |
-
image =
|
134 |
# image = transforms.ToTensor()(image).unsqueeze(0)
|
135 |
|
136 |
text_inputs = tokenizer(
|
|
|
13 |
from torchvision.transforms import CenterCrop, ConvertImageDtype, Normalize, Resize
|
14 |
from torchvision.transforms.functional import InterpolationMode
|
15 |
from torchvision import transforms
|
16 |
+
from torchvision.io import ImageReadMode, read_image
|
17 |
+
|
18 |
|
19 |
from transformers import CLIPModel, AutoModel
|
20 |
from huggingface_hub import hf_hub_download
|
|
|
132 |
def predict_sentiment(text, image):
|
133 |
print(text, image)
|
134 |
print(dir(image))
|
135 |
+
image = read_image(image, mode=ImageReadMode.RGB)
|
136 |
# image = transforms.ToTensor()(image).unsqueeze(0)
|
137 |
|
138 |
text_inputs = tokenizer(
|