Update README.md
Browse files
README.md
CHANGED
@@ -39,14 +39,21 @@ pip install transformers torch accelerate
|
|
39 |
|
40 |
Then the model can be downloaded and used for inference:
|
41 |
```py
|
42 |
-
from transformers import
|
43 |
|
44 |
-
|
45 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
|
47 |
-
tokens = tokenizer("Our country is the most powerful country in the world!", return_tensors="pt")
|
48 |
-
output = model(**tokens)
|
49 |
-
print(output.logits)
|
50 |
```
|
51 |
|
52 |
## Training Details
|
|
|
39 |
|
40 |
Then the model can be downloaded and used for inference:
|
41 |
```py
|
42 |
+
from transformers import pipeline
|
43 |
|
44 |
+
labels_map = {"LABEL_0": "No Propaganda", "LABEL_1": "Propaganda"}
|
45 |
+
|
46 |
+
pipe = pipeline(
|
47 |
+
"text-classification",
|
48 |
+
model="identrics/wasper_propaganda_detection_en",
|
49 |
+
tokenizer="identrics/wasper_propaganda_detection_en",
|
50 |
+
)
|
51 |
+
|
52 |
+
text = "Our country is the most powerful country in the world!"
|
53 |
+
|
54 |
+
prediction = pipe(text)
|
55 |
+
print(labels_map[prediction[0]["label"]])
|
56 |
|
|
|
|
|
|
|
57 |
```
|
58 |
|
59 |
## Training Details
|