Spaces:
Paused
Paused
| from ultralytics import YOLO | |
| import os | |
| def init_model(): | |
| print("Initializing YOLO26 model...") | |
| try: | |
| # Load the latest YOLO26 nano model | |
| model = YOLO("yolo26n.pt") | |
| print("Model loaded successfully.") | |
| # Verify model classes (conceptual check) | |
| # Note: For this demo, we will manually override the names in the wrapper | |
| # if the default model doesn't have our specific chicken classes. | |
| return model | |
| except Exception as e: | |
| print(f"Error initializing model: {e}") | |
| # Fallback to YOLOv8 if YOLO26 is not yet available in the environment | |
| print("Falling back to YOLOv8n for development...") | |
| return YOLO("yolov8n.pt") | |
| if __name__ == "__main__": | |
| init_model() | |