Ahmed766 commited on
Commit
be57e68
·
verified ·
1 Parent(s): 780d705

Upload test_model.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. test_model.py +31 -0
test_model.py ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Simple test script for the text classification model
3
+ """
4
+
5
+ from text_classifier import TextClassifier
6
+
7
+ def test_model():
8
+ classifier = TextClassifier()
9
+
10
+ # Test cases
11
+ test_cases = [
12
+ ("I love this product!", "positive"),
13
+ ("This is terrible.", "negative"),
14
+ ("It's okay, nothing special.", None), # Could be positive or neutral
15
+ ]
16
+
17
+ print("Testing Text Classification Model:")
18
+ print("-" * 40)
19
+
20
+ for text, expected_label in test_cases:
21
+ result = classifier.predict(text)
22
+ print(f"Input: {text}")
23
+ print(f"Predicted: {result['label']} (confidence: {result['confidence']})")
24
+ if expected_label:
25
+ print(f"Expected: {expected_label}")
26
+ print()
27
+
28
+ print("Test completed successfully!")
29
+
30
+ if __name__ == "__main__":
31
+ test_model()