Spaces:
Sleeping
Sleeping
File size: 534 Bytes
0403b6d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
from transformers import pipeline
# Load the classifier
classifier = pipeline("text-classification", model="models/bert-liar-fake-news", tokenizer="bert-base-uncased")
# Define the predict function
def predict(text):
result = classifier(text)
label = result[0]['label']
score = result[0]['score']
return label, score
# Example usage
if __name__ == "__main__":
text = input("Enter a statement to evaluate:\n")
label, score = predict(text)
print(f"Prediction: {label} (Confidence: {score:.2f})") |