Spaces:
Running
on
Zero
Running
on
Zero
Lord-Raven
commited on
Commit
·
6cf159b
1
Parent(s):
2a07486
Trying to re-use pipeline.
Browse files
app.py
CHANGED
@@ -3,12 +3,12 @@ import json
|
|
3 |
from transformers import pipeline
|
4 |
from transformers import AutoTokenizer
|
5 |
|
|
|
|
|
6 |
def zero_shot_classification(data_string):
|
7 |
print(data_string)
|
8 |
data = json.loads(data_string)
|
9 |
print(data)
|
10 |
-
classifier = pipeline(task='zero-shot-classification', model='typeform/distilbert-base-uncased-mnli')
|
11 |
-
print('classifier setup')
|
12 |
results = classifier(data['sequence'], candidate_labels=data['candidate_labels'], hypothesis_template=data['hypothesis_template'], multi_label=data['multi_label'])
|
13 |
return results
|
14 |
|
|
|
3 |
from transformers import pipeline
|
4 |
from transformers import AutoTokenizer
|
5 |
|
6 |
+
classifier = pipeline(task='zero-shot-classification', model='typeform/distilbert-base-uncased-mnli')
|
7 |
+
|
8 |
def zero_shot_classification(data_string):
|
9 |
print(data_string)
|
10 |
data = json.loads(data_string)
|
11 |
print(data)
|
|
|
|
|
12 |
results = classifier(data['sequence'], candidate_labels=data['candidate_labels'], hypothesis_template=data['hypothesis_template'], multi_label=data['multi_label'])
|
13 |
return results
|
14 |
|