Update README.md
Browse files
README.md
CHANGED
@@ -40,14 +40,20 @@ pip install transformers torch accelerate
|
|
40 |
|
41 |
Then the model can be downloaded and used for inference:
|
42 |
```py
|
43 |
-
from transformers import
|
44 |
|
45 |
-
|
46 |
-
tokenizer = AutoTokenizer.from_pretrained("identrics/wasper_propaganda_detection_bg")
|
47 |
|
48 |
-
|
49 |
-
|
50 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
```
|
52 |
|
53 |
|
|
|
40 |
|
41 |
Then the model can be downloaded and used for inference:
|
42 |
```py
|
43 |
+
from transformers import pipeline
|
44 |
|
45 |
+
labels_map = {"LABEL_0": "No Propaganda", "LABEL_1": "Propaganda"}
|
|
|
46 |
|
47 |
+
pipe = pipeline(
|
48 |
+
"text-classification",
|
49 |
+
model="identrics/wasper_propaganda_detection_bg",
|
50 |
+
tokenizer="identrics/wasper_propaganda_detection_bg",
|
51 |
+
)
|
52 |
+
|
53 |
+
text = "Газа евтин, американското ядрено гориво евтино, пълно с фотоволтаици а пък тока с 30% нагоре. Защо ?"
|
54 |
+
|
55 |
+
prediction = pipe(text)
|
56 |
+
print(labels_map[prediction[0]["label"]])
|
57 |
```
|
58 |
|
59 |
|