Update app.py
Browse files
app.py
CHANGED
|
@@ -114,32 +114,6 @@ shared_results = {
|
|
| 114 |
# ------------------------------
|
| 115 |
# 4. FONCTIONS UTILITAIRES
|
| 116 |
# ------------------------------
|
| 117 |
-
|
| 118 |
-
def save_complete_results(plate_info, color, model, orientation, vehicle_type, brand):
|
| 119 |
-
"""Sauvegarde toutes les informations dans resultats.txt"""
|
| 120 |
-
with open("/content/drive/MyDrive/resultats.txt", "a", encoding="utf-8") as f:
|
| 121 |
-
f.write("\n" + "="*60 + "\n")
|
| 122 |
-
f.write(f"ANALYSE EFFECTUÉE LE : {datetime.now().strftime('%d/%m/%Y %H:%M:%S')}\n")
|
| 123 |
-
f.write("="*60 + "\n\n")
|
| 124 |
-
f.write("INFORMATIONS PLAQUE:\n")
|
| 125 |
-
f.write("-"*50 + "\n")
|
| 126 |
-
if plate_info:
|
| 127 |
-
f.write(f"Numéro complet: {plate_info.get('matricule_complet', 'N/A')}\n")
|
| 128 |
-
f.write(f"Wilaya: {plate_info.get('wilaya', ('', 'N/A'))[1]} ({plate_info.get('wilaya', ('', ''))[0]})\n")
|
| 129 |
-
f.write(f"Année: {plate_info.get('annee', 'N/A')}\n")
|
| 130 |
-
f.write(f"Catégorie: {plate_info.get('categorie', ('', 'N/A'))[1]} ({plate_info.get('categorie', ('', ''))[0]})\n")
|
| 131 |
-
f.write(f"Série: {plate_info.get('serie', 'N/A')}\n")
|
| 132 |
-
else:
|
| 133 |
-
f.write("Aucune information de plaque disponible\n")
|
| 134 |
-
f.write("\nCARACTÉRISTIQUES VÉHICULE:\n")
|
| 135 |
-
f.write("-"*50 + "\n")
|
| 136 |
-
f.write(f"Couleur: {color if color else 'Non détectée'}\n")
|
| 137 |
-
f.write(f"Marque: {brand if brand else 'Non détectée'}\n")
|
| 138 |
-
f.write(f"Modèle: {model if model else 'Non détecté'}\n")
|
| 139 |
-
f.write(f"Orientation: {orientation if orientation else 'Non détectée'}\n")
|
| 140 |
-
f.write(f"Type de véhicule: {vehicle_type if vehicle_type else 'Non détecté'}\n")
|
| 141 |
-
f.write("\n" + "="*60 + "\n\n")
|
| 142 |
-
|
| 143 |
def classify_plate(text):
|
| 144 |
"""Classification des plaques algériennes (10-11 chiffres)"""
|
| 145 |
try:
|
|
@@ -155,7 +129,7 @@ def classify_plate(text):
|
|
| 155 |
middle = clean_text[3:9]
|
| 156 |
wilaya_code = clean_text[9:]
|
| 157 |
|
| 158 |
-
wilaya = WILAYAS.get(wilaya_code, ("", "Wilaya
|
| 159 |
categorie_code = middle[0]
|
| 160 |
annee = middle[1:3]
|
| 161 |
|
|
@@ -738,7 +712,7 @@ def classify_plate_number():
|
|
| 738 |
# 7. GESTION BASE DE DONNÉES
|
| 739 |
# ------------------------------
|
| 740 |
|
| 741 |
-
DB_PATH =
|
| 742 |
TIME_PATTERN = re.compile(r'^\d{2}:\d{2}-\d{2}:\d{2}$')
|
| 743 |
|
| 744 |
def create_connection():
|
|
|
|
| 114 |
# ------------------------------
|
| 115 |
# 4. FONCTIONS UTILITAIRES
|
| 116 |
# ------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 117 |
def classify_plate(text):
|
| 118 |
"""Classification des plaques algériennes (10-11 chiffres)"""
|
| 119 |
try:
|
|
|
|
| 129 |
middle = clean_text[3:9]
|
| 130 |
wilaya_code = clean_text[9:]
|
| 131 |
|
| 132 |
+
wilaya = WILAYAS.get(wilaya_code, ("", "Wilaya inonnue"))
|
| 133 |
categorie_code = middle[0]
|
| 134 |
annee = middle[1:3]
|
| 135 |
|
|
|
|
| 712 |
# 7. GESTION BASE DE DONNÉES
|
| 713 |
# ------------------------------
|
| 714 |
|
| 715 |
+
DB_PATH = "vehicules_database.db"
|
| 716 |
TIME_PATTERN = re.compile(r'^\d{2}:\d{2}-\d{2}:\d{2}$')
|
| 717 |
|
| 718 |
def create_connection():
|