Update README.md
Browse files
README.md
CHANGED
@@ -29,8 +29,20 @@ result summary:
|
|
29 |
usage:
|
30 |
|
31 |
```
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
```
|
|
|
29 |
usage:
|
30 |
|
31 |
```
|
32 |
+
from transformers import pipeline, AutoModelForSequenceClassification, AutoTokenizer
|
33 |
+
|
34 |
+
|
35 |
+
def main(repository: str):
|
36 |
+
|
37 |
+
model = AutoModelForSequenceClassification.from_pretrained(repository)
|
38 |
+
|
39 |
+
tokenizer = AutoTokenizer.from_pretrained(repository)
|
40 |
+
|
41 |
+
nlp = pipeline("text-classification", model=model, tokenizer=tokenizer)
|
42 |
+
|
43 |
+
print(nlp("the masses are controlled by media. I am left wing"))
|
44 |
+
|
45 |
+
if __name__ == "__main__":
|
46 |
+
main(repository="premsa/political-bias-prediction-allsides-BERT")
|
47 |
+
|
48 |
```
|