File size: 2,734 Bytes
91d209c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#!/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"