Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Update app.py
Browse files
app.py
CHANGED
@@ -14,9 +14,9 @@ pipes = {
|
|
14 |
images="festival.jpg"
|
15 |
|
16 |
def shot(image, labels_text):
|
17 |
-
|
18 |
labels = labels_text.split(",")
|
19 |
-
res = pipes['chinese-clip-vit-base-patch16'](images=
|
20 |
candidate_labels=labels,
|
21 |
hypothesis_template= "This example is {}.")
|
22 |
return {dic["label"]: dic["score"] for dic in res}
|
|
|
14 |
images="festival.jpg"
|
15 |
|
16 |
def shot(image, labels_text):
|
17 |
+
PIL_image = Image.fromarray(np.uint8(image)).convert('RGB')
|
18 |
labels = labels_text.split(",")
|
19 |
+
res = pipes['chinese-clip-vit-base-patch16'](images=PIL_image,
|
20 |
candidate_labels=labels,
|
21 |
hypothesis_template= "This example is {}.")
|
22 |
return {dic["label"]: dic["score"] for dic in res}
|