Spaces:
Sleeping
Sleeping
| # Setup script for Python backend | |
| echo "π Setting up React Video Editor Python Backend..." | |
| # Check Python version | |
| echo "π Checking Python version..." | |
| python_version=$(python3 --version 2>&1 | awk '{print $2}') | |
| required_version="3.9" | |
| if [ "$(printf '%s\n' "$required_version" "$python_version" | sort -V | head -n1)" != "$required_version" ]; then | |
| echo "β Python 3.9 or higher is required. Found: $python_version" | |
| exit 1 | |
| fi | |
| echo "β Python $python_version" | |
| # Check for ffmpeg | |
| echo "π Checking for ffmpeg..." | |
| if command -v ffmpeg &> /dev/null; then | |
| echo "β ffmpeg is installed" | |
| else | |
| echo "β οΈ ffmpeg not found. Install it for video processing:" | |
| echo " macOS: brew install ffmpeg" | |
| echo " Ubuntu: sudo apt install ffmpeg" | |
| fi | |
| # Create virtual environment | |
| echo "π¦ Creating virtual environment..." | |
| python3 -m venv venv | |
| # Activate virtual environment | |
| echo "π§ Activating virtual environment..." | |
| source venv/bin/activate | |
| # Upgrade pip | |
| echo "π¦ Upgrading pip..." | |
| pip install --upgrade pip | |
| # Install dependencies | |
| echo "π¦ Installing dependencies..." | |
| pip install -r requirements.txt | |
| echo "" | |
| echo "π¦ Installing optional video processing (moviepy)..." | |
| pip install moviepy | |
| echo "" | |
| echo "π¦ Attempting to install Whisper..." | |
| echo " Note: Whisper may fail on Python 3.13" | |
| pip install git+https://github.com/openai/whisper.git || { | |
| echo "β οΈ Whisper installation failed (this is okay!)" | |
| echo " Backend will use fixed timestamps instead" | |
| echo " See WHISPER_INSTALL.md for manual installation" | |
| } | |
| # Create storage directories | |
| echo "π Creating storage directories..." | |
| mkdir -p storage/images | |
| mkdir -p storage/videos | |
| # Copy env file if it doesn't exist | |
| if [ ! -f .env.local ]; then | |
| echo "π Creating .env.local from template..." | |
| cat > .env.local << EOF | |
| # Server Configuration | |
| SERVER_PORT=4000 | |
| PUBLIC_URL=http://localhost:4000 | |
| # API Keys | |
| KIE_API_KEY=your_kie_api_key_here | |
| VITE_GEMINI_API_KEY=your_gemini_api_key_here | |
| # Get your KIE API key at: https://kie.ai/api-key | |
| # Get your Gemini API key at: https://makersuite.google.com/app/apikey | |
| EOF | |
| echo "β οΈ Please edit .env.local and add your API keys" | |
| else | |
| echo "β .env.local already exists" | |
| fi | |
| echo "" | |
| echo "β Setup complete!" | |
| echo "" | |
| echo "π Whisper installed! Frame extraction will now:" | |
| echo " - Detect actual last spoken word" | |
| echo " - Extract frames from post-speech zone" | |
| echo " - Provide intelligent transition frames" | |
| echo "" | |
| echo "Next steps:" | |
| echo "1. Edit .env.local and add your API keys" | |
| echo "2. Activate virtual environment: source venv/bin/activate" | |
| echo "3. Run the server: python main.py" | |
| echo "" | |
| echo "Or use Docker:" | |
| echo "docker-compose up" | |