whitphx HF staff commited on
Commit
4a3ec14
1 Parent(s): b75b060

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +3 -1
index.html CHANGED
@@ -19,7 +19,9 @@ pipeline = transformers.pipeline
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)
 
19
  pipe = await pipeline('zero-shot-image-classification')
20
 
21
  async def classify(image, classes):
22
+ if not image:
23
+ return {}
24
+ classes = [x for c in classes.split(",") if (x := c.strip())]
25
  if not classes:
26
  return {}
27
  data = await pipe(as_url(image), classes)