Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -7,7 +7,7 @@ from transformers import pipeline
|
|
7 |
|
8 |
asr = pipeline("automatic-speech-recognition")
|
9 |
latent = gr.Interface.load("spaces/multimodalart/latentdiffusion")
|
10 |
-
zero = pipeline("zero-shot-image-classification"
|
11 |
#zero = gr.Interface.load("spaces/Datatrooper/zero-shot-image-classification")
|
12 |
#tts = gr.Interface.load("spaces/osanseviero/tortoisse-tts")
|
13 |
|
@@ -49,9 +49,9 @@ def zero_shot(image, text_input):
|
|
49 |
return {dic["label"]: dic["score"] for dic in res}
|
50 |
|
51 |
def shot(image, labels_text):
|
52 |
-
|
53 |
labels = labels_text.split(",")
|
54 |
-
res = pipe(images=
|
55 |
candidate_labels=labels,
|
56 |
hypothesis_template= "This is a photo of a {}")
|
57 |
return {dic["label"]: dic["score"] for dic in res}
|
|
|
7 |
|
8 |
asr = pipeline("automatic-speech-recognition")
|
9 |
latent = gr.Interface.load("spaces/multimodalart/latentdiffusion")
|
10 |
+
zero = pipeline("zero-shot-image-classification")
|
11 |
#zero = gr.Interface.load("spaces/Datatrooper/zero-shot-image-classification")
|
12 |
#tts = gr.Interface.load("spaces/osanseviero/tortoisse-tts")
|
13 |
|
|
|
49 |
return {dic["label"]: dic["score"] for dic in res}
|
50 |
|
51 |
def shot(image, labels_text):
|
52 |
+
PIL_image = Image.fromarray(np.uint8(image)).convert('RGB')
|
53 |
labels = labels_text.split(",")
|
54 |
+
res = pipe(images= PIL_image,
|
55 |
candidate_labels=labels,
|
56 |
hypothesis_template= "This is a photo of a {}")
|
57 |
return {dic["label"]: dic["score"] for dic in res}
|