AyoubChLin
commited on
Commit
•
b05964f
1
Parent(s):
41bd2ae
Update README.md
Browse files
README.md
CHANGED
@@ -38,20 +38,21 @@ To use this model for zero-shot classification, you can follow the steps below:
|
|
38 |
|
39 |
4. Classify text using zero-shot classification:
|
40 |
|
41 |
-
|
|
|
42 |
|
43 |
-
|
44 |
|
45 |
-
|
46 |
-
|
47 |
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
|
52 |
-
|
53 |
|
54 |
-
|
55 |
|
56 |
```
|
57 |
|
|
|
38 |
|
39 |
4. Classify text using zero-shot classification:
|
40 |
|
41 |
+
```python
|
42 |
+
|
43 |
|
44 |
+
from transformers import pipeline
|
45 |
|
46 |
+
# Create a zero-shot classification pipeline
|
47 |
+
classifier = pipeline("zero-shot-classification", model=model, tokenizer=tokenizer)
|
48 |
|
49 |
+
# Classify a sentence
|
50 |
+
sentence = "The latest scientific breakthroughs in medicine"
|
51 |
+
candidate_labels = ["politics", "sports", "technology", "business"]
|
52 |
|
53 |
+
result = classifier(sentence, candidate_labels)
|
54 |
|
55 |
+
print(result)
|
56 |
|
57 |
```
|
58 |
|