boryana commited on
Commit
ed81358
1 Parent(s): 5e14519

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +12 -6
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 AutoModelForSequenceClassification, AutoTokenizer
44
 
45
- model = AutoModelForSequenceClassification.from_pretrained("identrics/wasper_propaganda_detection_bg", num_labels=2)
46
- tokenizer = AutoTokenizer.from_pretrained("identrics/wasper_propaganda_detection_bg")
47
 
48
- tokens = tokenizer("Газа евтин, американското ядрено гориво евтино, пълно с фотоволтаици а пък тока с 30% нагоре. Защо ?", return_tensors="pt")
49
- output = model(**tokens)
50
- print(output.logits)
 
 
 
 
 
 
 
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