Spaces:
				
			
			
	
			
			
		Runtime error
		
	
	
	
			
			
	
	
	
	
		
		
		Runtime error
		
	Create controller.py
Browse files- controller.py +22 -0
    	
        controller.py
    ADDED
    
    | @@ -0,0 +1,22 @@ | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | 
|  | |
| 1 | 
            +
            # controller.py
         | 
| 2 | 
            +
            from services.under_construction.bridge_pier_check import process_bridge_piers
         | 
| 3 | 
            +
            from services.under_construction.culvert_check import process_culverts
         | 
| 4 | 
            +
            from services.under_construction.earthwork_detection import process_earthwork
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            def detect_under_construction_objects(frame, mode: str):
         | 
| 7 | 
            +
                """
         | 
| 8 | 
            +
                Dispatches frame to the appropriate detection function based on mode.
         | 
| 9 | 
            +
                Args:
         | 
| 10 | 
            +
                    frame: Input frame as a numpy array.
         | 
| 11 | 
            +
                    mode: One of "bridge", "culvert", "earthwork".
         | 
| 12 | 
            +
                Returns:
         | 
| 13 | 
            +
                    Tuple of (detections, annotated_frame)
         | 
| 14 | 
            +
                """
         | 
| 15 | 
            +
                if mode == "bridge":
         | 
| 16 | 
            +
                    return process_bridge_piers(frame)
         | 
| 17 | 
            +
                elif mode == "culvert":
         | 
| 18 | 
            +
                    return process_culverts(frame)
         | 
| 19 | 
            +
                elif mode == "earthwork":
         | 
| 20 | 
            +
                    return process_earthwork(frame)
         | 
| 21 | 
            +
                else:
         | 
| 22 | 
            +
                    raise ValueError(f"Unknown mode: {mode}")
         | 
