Initial commit — Serveur Lucas SmartEye
API réception alertes chute (SmartEye/YOLO), analyse IA (Gemini 2.5 Flash), gestion alertes avec escalade (watchdog), notifications Firebase, dashboard web, documentation MkDocs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
69
test_analyze_full.py
Normal file
69
test_analyze_full.py
Normal file
@@ -0,0 +1,69 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Test complet du système d'analyse avec une vraie image
|
||||
"""
|
||||
import sys
|
||||
import json
|
||||
import os
|
||||
|
||||
# Import du module d'analyse
|
||||
sys.path.insert(0, '/var/www/lucas')
|
||||
from analyze import analyze_image
|
||||
|
||||
print("="*70)
|
||||
print("TEST COMPLET DU SYSTÈME D'ANALYSE")
|
||||
print("="*70)
|
||||
|
||||
# Image de test
|
||||
test_image = "/var/www/lucas/test_alerte.jpg"
|
||||
|
||||
if not os.path.exists(test_image):
|
||||
print(f"✗ Image de test introuvable: {test_image}")
|
||||
sys.exit(1)
|
||||
|
||||
print(f"\n📸 Image testée: {test_image}")
|
||||
print(f"📊 Taille: {os.path.getsize(test_image)} octets")
|
||||
|
||||
print("\n🤖 Lancement de l'analyse IA...")
|
||||
print("-"*70)
|
||||
|
||||
try:
|
||||
result = analyze_image(test_image)
|
||||
|
||||
print("\n✓ ANALYSE TERMINÉE")
|
||||
print("-"*70)
|
||||
print(json.dumps(result, indent=2, ensure_ascii=False))
|
||||
|
||||
# Analyser le résultat
|
||||
print("\n📋 INTERPRÉTATION")
|
||||
print("-"*70)
|
||||
|
||||
if result.get("urgence"):
|
||||
print("🚨 URGENCE DÉTECTÉE")
|
||||
print(f" Confiance: {result.get('confiance', 'N/A')}%")
|
||||
print(f" Message: {result.get('message', 'N/A')}")
|
||||
|
||||
if "error_details" in result:
|
||||
print("\n⚠️ DÉTAILS DE L'ERREUR:")
|
||||
for key, value in result["error_details"].items():
|
||||
print(f" - {key}: {value}")
|
||||
else:
|
||||
print("✓ PAS D'URGENCE")
|
||||
print(f" Confiance: {result.get('confiance', 'N/A')}%")
|
||||
print(f" Message: {result.get('message', 'N/A')}")
|
||||
|
||||
print("\n" + "="*70)
|
||||
print("Test terminé avec succès")
|
||||
print("="*70)
|
||||
|
||||
except KeyboardInterrupt:
|
||||
print("\n\n⚠️ Test interrompu par l'utilisateur")
|
||||
sys.exit(1)
|
||||
|
||||
except Exception as e:
|
||||
print(f"\n✗ ERREUR LORS DU TEST")
|
||||
print(f" Type: {type(e).__name__}")
|
||||
print(f" Message: {str(e)}")
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
sys.exit(1)
|
||||
Reference in New Issue
Block a user