-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_quick.py
More file actions
36 lines (28 loc) · 1.14 KB
/
test_quick.py
File metadata and controls
36 lines (28 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env python3
"""Quick test of the bias detection functionality."""
import sys
import os
sys.path.append('app')
from app.utils import predict_bias_zero_shot
def test_basic_functionality():
"""Test basic bias prediction."""
# Test different types of text
test_cases = [
"This progressive policy will help working families and reduce inequality.",
"Conservative values and traditional family structures are important for society.",
"The economic data shows mixed results with both positive and negative indicators."
]
print("🧪 Testing News Bias Detector...\n")
for i, text in enumerate(test_cases, 1):
print(f"Test {i}: {text[:50]}...")
try:
result = predict_bias_zero_shot(text)
print(f" → Prediction: {result['label']} (confidence: {result['prob']:.2f})")
print(f" → Bias score: {result['score']:.2f}")
print()
except Exception as e:
print(f" → Error: {e}")
print()
print("✅ Basic functionality test completed!")
if __name__ == "__main__":
test_basic_functionality()