Fix Run All Tests to use last detection result for dynamic messaging
✅ Fixed Logic: - Reverted hardcoded image back to memory image (training/memory/out1.png) - Added lastDetectionResult global variable to track last detection - Run All Tests now uses the last detection result (from upload or hardcoded test) ✅ Dynamic Behavior: - Upload image with memory → Run All Tests shows '✅ Found X memory modules' - Upload image without memory → Run All Tests shows '❌ No memory modules' - No previous upload → Run All Tests uses hardcoded image (with memory) ✅ Workflow: 1. User uploads image without memory → detects 0 modules 2. User clicks 'Run All Tests' → shows '❌ No memory modules' 3. User uploads image with memory → detects X modules 4. User clicks 'Run All Tests' → shows '✅ Found X memory modules' ✅ Reset Logic: - lastDetectionResult reset when file upload is reset - Clean state management between different uploads Now the Run All Tests correctly reflects the last detection result
This commit is contained in:
@@ -37,7 +37,7 @@ MODEL_PATH = 'runs/detect/memory_module_detection/weights/best.pt'
|
||||
detector = MemoryModuleDetector(MODEL_PATH)
|
||||
|
||||
# Hardcoded test image path
|
||||
HARDCODED_IMAGE_PATH = 'training/no_memory/out1.png'
|
||||
HARDCODED_IMAGE_PATH = 'training/memory/out1.png'
|
||||
|
||||
def allowed_file(filename):
|
||||
"""Check if file extension is allowed."""
|
||||
|
||||
Reference in New Issue
Block a user