sushilideaclan01's picture
first push
91d209c
#!/bin/bash
# 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"