boryana commited on
Commit
dbd7435
1 Parent(s): 81aa429

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +13 -6
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 AutoModelForSequenceClassification, AutoTokenizer
43
 
44
- model = AutoModelForSequenceClassification.from_pretrained("identrics/wasper_propaganda_detection_en", num_labels=2)
45
- tokenizer = AutoTokenizer.from_pretrained("identrics/wasper_propaganda_detection_en")
 
 
 
 
 
 
 
 
 
 
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