text-classification-demo / test_model.py
Ahmed766's picture
Upload test_model.py with huggingface_hub
be57e68 verified
"""
Simple test script for the text classification model
"""
from text_classifier import TextClassifier
def test_model():
classifier = TextClassifier()
# Test cases
test_cases = [
("I love this product!", "positive"),
("This is terrible.", "negative"),
("It's okay, nothing special.", None), # Could be positive or neutral
]
print("Testing Text Classification Model:")
print("-" * 40)
for text, expected_label in test_cases:
result = classifier.predict(text)
print(f"Input: {text}")
print(f"Predicted: {result['label']} (confidence: {result['confidence']})")
if expected_label:
print(f"Expected: {expected_label}")
print()
print("Test completed successfully!")
if __name__ == "__main__":
test_model()