Spaces:
Paused
Paused
Create main.py
Browse files
main.py
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
2 |
+
|
3 |
+
tokenizer = AutoTokenizer.from_pretrained("vikram71198/distilroberta-base-finetuned-fake-news-detection")
|
4 |
+
model = AutoModelForSequenceClassification.from_pretrained("vikram71198/distilroberta-base-finetuned-fake-news-detection")
|
5 |
+
text = "This movie is really good!"
|
6 |
+
inputs = tokenizer(text, return_tensors="pt")
|
7 |
+
outputs = model(**inputs)
|
8 |
+
|
9 |
+
print(f"Input text: {text}")
|
10 |
+
print(f"Predicted label: {outputs[0]['label']}, score: {outputs[0]['score']:.2f}")
|