article-summarizer / setup_web_app.sh
Vineeth Sai
Initial deploy to HF Spaces (Docker)
501847e
#!/bin/bash
echo "πŸš€ Setting up AI Article Summarizer Web App"
echo "============================================="
# Create project structure
echo "πŸ“ Creating project structure..."
mkdir -p templates static/audio static/summaries
# Create requirements.txt
echo "πŸ“ Creating requirements.txt..."
cat > requirements.txt << EOF
Flask==2.3.3
torch>=2.0.0
transformers>=4.30.0
trafilatura>=1.6.0
soundfile>=0.12.1
kokoro>=0.9.2
librosa>=0.10.0
numpy>=1.24.0
scipy>=1.10.0
EOF
# Check if virtual environment exists
if [ ! -d "venv" ]; then
echo "🐍 Creating virtual environment..."
python3 -m venv venv
fi
echo "πŸ”„ Activating virtual environment..."
source venv/bin/activate
echo "πŸ“¦ Installing Python packages..."
pip install --upgrade pip
pip install -r requirements.txt
# Install system dependencies (macOS)
if [[ "$OSTYPE" == "darwin"* ]]; then
echo "🍎 Installing espeak for macOS..."
if ! command -v brew &> /dev/null; then
echo "❌ Homebrew not found. Please install Homebrew first:"
echo " /bin/bash -c \"\$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)\""
exit 1
fi
brew install espeak
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
echo "🐧 Installing espeak for Linux..."
sudo apt-get update && sudo apt-get install -y espeak-ng
fi
echo "βœ… Setup complete!"
echo ""
echo "🌟 To run the web application:"
echo " 1. Activate virtual environment: source venv/bin/activate"
echo " 2. Run the app: python app.py"
echo " 3. Open http://localhost:5000 in your browser"
echo ""
echo "πŸ“ Note: The first run will download AI models (~1.2GB)"
echo "⏱️ Model loading may take 1-2 minutes on first startup"