hm_video_ai_qc_tool/setup.sh
2025-12-31 12:59:50 +02:00

95 lines
2.6 KiB
Bash
Executable file

#!/bin/bash
# Setup script for HM Video QC Tool
set -e # Exit on error
echo "=================================================="
echo "HM Video QC Tool - Setup Script"
echo "=================================================="
echo ""
# Check Python version
echo "Checking Python version..."
python_version=$(python3 --version 2>&1 | awk '{print $2}')
echo "Found Python $python_version"
# Check if FFmpeg is installed
echo ""
echo "Checking FFmpeg installation..."
if command -v ffmpeg &> /dev/null; then
ffmpeg_version=$(ffmpeg -version | head -n1)
echo "✓ FFmpeg is installed: $ffmpeg_version"
else
echo "✗ FFmpeg not found!"
echo ""
echo "Please install FFmpeg:"
echo " macOS: brew install ffmpeg"
echo " Ubuntu: sudo apt-get install ffmpeg"
echo " Windows: Download from https://ffmpeg.org/download.html"
exit 1
fi
# Create virtual environment if it doesn't exist
echo ""
if [ ! -d "venv" ]; then
echo "Creating virtual environment..."
python3 -m venv venv
echo "✓ Virtual environment created"
else
echo "✓ Virtual environment already exists"
fi
# Activate virtual environment
echo ""
echo "Activating virtual environment..."
source venv/bin/activate
# Upgrade pip
echo ""
echo "Upgrading pip..."
pip install --upgrade pip
# Install dependencies
echo ""
echo "Installing Python dependencies..."
pip install -r requirements.txt
# Create .env file if it doesn't exist
echo ""
if [ ! -f ".env" ]; then
echo "Creating .env file from template..."
cp .env.example .env
echo "✓ .env file created"
echo ""
echo "⚠️ IMPORTANT: Edit .env and add your OPENAI_API_KEY"
else
echo "✓ .env file already exists"
fi
# Create necessary directories
echo ""
echo "Creating working directories..."
mkdir -p tmp/HM_video_working
mkdir -p tmp/reports
mkdir -p supporting/censorship_trainset
echo "✓ Directories created"
# Set environment to dev by default
echo ""
echo "Setting environment to 'dev' mode..."
export HM_VIDEO_QC_ENV=dev
echo ""
echo "=================================================="
echo "Setup Complete!"
echo "=================================================="
echo ""
echo "Next steps:"
echo "1. Edit .env and add your OPENAI_API_KEY"
echo "2. (Optional) Add censorship training data to ./supporting/censorship_trainset/"
echo "3. Activate the virtual environment: source venv/bin/activate"
echo "4. Run a test: python launchers/video_launcher_CLI.py <video_file> <output_report>"
echo ""
echo "Example:"
echo " python launchers/video_launcher_CLI.py test_video.mp4 ./tmp/reports/report.html"
echo ""