visual-narrator-llm / benchmarking /test_polished_outputs.py
Ytgetahun's picture
feat: Visual Narrator 3B - Clean repository with professional benchmarks
d6e97b5
import requests
def test_polished_api():
"""Test the polished API for grammar and repetition fixes"""
test_scenes = [
"A car driving through a city at night with neon lights",
"A person dancing in a room with colorful lighting effects",
"A elegant eagle flying over a mountain", # Test "a" vs "an"
"A old building with ancient architecture" # Test various cases
]
print("🎯 TESTING POLISHED API - GRAMMAR & REPETITION FIXES")
print("=" * 65)
for scene in test_scenes:
response = requests.post(
"http://localhost:8008/describe/scene",
json={"scene_description": scene, "enhance_adjectives": True}
)
if response.status_code == 200:
result = response.json()
output = result["enhanced_description"]
print(f"πŸ“ INPUT: {scene}")
print(f"πŸ’Ž OUTPUT: {output}")
# Check for common issues
issues = []
if " a " in output.lower() and any(output.lower().count(f" {word} {word} ") > 0 for word in ['neon', 'colorful', 'dynamic']):
issues.append("word repetition")
if re.search(r'\ba [aeiou]', output, re.IGNORECASE):
issues.append("a/an grammar")
if " " in output:
issues.append("double spaces")
if issues:
print(f"❌ ISSUES: {', '.join(issues)}")
else:
print(f"βœ… CLEAN: No grammar or repetition issues")
print("─" * 65)
if __name__ == "__main__":
test_polished_api()