binsan commited on
Commit
c11b2c8
·
1 Parent(s): 9f00cc8
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -12,4 +12,9 @@ def greet_json():
12
  "This is a course about the Transformers library",
13
  candidate_labels=["education", "politics", "business"],
14
  )
15
- return {"Hello": str(j)}
 
 
 
 
 
 
12
  "This is a course about the Transformers library",
13
  candidate_labels=["education", "politics", "business"],
14
  )
15
+ return {"Hello": str(j)}
16
+
17
+ @app.post('/zero-shot-classification')
18
+ def classify(source: str, labels: list[str]) -> dict[str, str]:
19
+ c = classifier(source, candidate_labels = labels)
20
+ return dict(zip(c['labels'], c['scores']))