ai-foley-studio-backend / download_model.py
abhi02072005's picture
Add automatic YOLO model download and audio directory setup
a6b8560
raw
history blame
796 Bytes
#!/usr/bin/env python3
"""
Download YOLOv8 model if not present
"""
import os
from pathlib import Path
def download_yolo_model():
"""Download YOLOv8n model if it doesn't exist"""
model_path = Path("yolov8n.pt")
if model_path.exists():
print(f"βœ“ YOLOv8 model already exists at {model_path}")
return
print("Downloading YOLOv8n model...")
try:
from ultralytics import YOLO
# This will automatically download the model
model = YOLO('yolov8n.pt')
print(f"βœ“ YOLOv8 model downloaded successfully to {model_path}")
except Exception as e:
print(f"βœ— Error downloading model: {e}")
print("The model will be downloaded automatically on first use.")
if __name__ == "__main__":
download_yolo_model()