Fix
Browse files- index.html +6 -3
index.html
CHANGED
@@ -19,9 +19,12 @@ pipeline = transformers.pipeline
|
|
19 |
pipe = await pipeline('zero-shot-image-classification')
|
20 |
|
21 |
async def classify(image, classes):
|
22 |
-
|
23 |
-
|
24 |
-
|
|
|
|
|
|
|
25 |
|
26 |
demo = gr.Interface(
|
27 |
classify,
|
|
|
19 |
pipe = await pipeline('zero-shot-image-classification')
|
20 |
|
21 |
async def classify(image, classes):
|
22 |
+
classes = [c for c in classes.split(",") if c]
|
23 |
+
if not classes:
|
24 |
+
return {}
|
25 |
+
data = await pipe(as_url(image), classes)
|
26 |
+
result = {item['label']: round(item['score'], 2) for item in data}
|
27 |
+
return result
|
28 |
|
29 |
demo = gr.Interface(
|
30 |
classify,
|