A community-supported supercharged document management system: scan, index and archive all your documents
Python aiangulararchivingdjangodmsdocument-managementdocument-management-systemllmmachine-learningocroptical-character-recognitionpdf
Handles a special case where the classification model exists, but no items are auto matching any longer
Trenton H26d5730ad227
diff --git a/src/documents/tasks.py b/src/documents/tasks.pyindex f1b65c45f..2dbc9d6eb 100644--- a/src/documents/tasks.py+++ b/src/documents/tasks.py@@ -65,6 +65,12 @@ def train_classifier():and not Correspondent.objects.filter(matching_algorithm=Tag.MATCH_AUTO).exists()and not StoragePath.objects.filter(matching_algorithm=Tag.MATCH_AUTO).exists()):+ logger.info("No automatic matching items, not training")+ # Special case, items were once auto and trained, so remove the model+ # and prevent its use again+ if settings.MODEL_FILE.exists():+ logger.info(f"Removing {settings.MODEL_FILE} so it won't be used")+ settings.MODEL_FILE.unlink()returnclassifier = load_classifier()