Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -16,7 +16,8 @@ text_inputs = torch.cat([clip.tokenize(f"a photo of a {c}") for c in cifar100.cl
|
|
| 16 |
def generateOutput(source):
|
| 17 |
# Prepare the inputs
|
| 18 |
# image, class_id = cifar100[3637]
|
| 19 |
-
|
|
|
|
| 20 |
|
| 21 |
with torch.no_grad():
|
| 22 |
image_features = model.encode_image(image_input)
|
|
|
|
| 16 |
def generateOutput(source):
|
| 17 |
# Prepare the inputs
|
| 18 |
# image, class_id = cifar100[3637]
|
| 19 |
+
image = Image.fromarray(image.astype('uint8'), 'RGB')
|
| 20 |
+
image_input = preprocess(image).unsqueeze(0).to(device)
|
| 21 |
|
| 22 |
with torch.no_grad():
|
| 23 |
image_features = model.encode_image(image_input)
|