AI_Personas / deploy_to_hf.sh
Claude
Add Hugging Face Spaces deployment script and gitignore
ee84c4b unverified
#!/bin/bash
# Deployment script for Hugging Face Spaces
# This script copies all necessary files to your HF Space directory
set -e # Exit on error
echo "πŸš€ AI Personas β†’ Hugging Face Spaces Deployment"
echo "================================================"
echo ""
# Check if HF Space directory path is provided
if [ -z "$1" ]; then
echo "❌ Error: Please provide the path to your cloned HF Space directory"
echo ""
echo "Usage: ./deploy_to_hf.sh /path/to/AI_Personas_HF_Space"
echo ""
echo "First, clone your HF Space:"
echo " cd ~"
echo " git clone https://huggingface.co/spaces/MatthewStroud/AI_Personas"
echo " cd AI_Personas"
echo ""
echo "Then run this script:"
echo " cd /home/user/AI_Personas"
echo " ./deploy_to_hf.sh ~/AI_Personas"
exit 1
fi
HF_DIR="$1"
# Check if directory exists
if [ ! -d "$HF_DIR" ]; then
echo "❌ Error: Directory $HF_DIR does not exist"
echo ""
echo "Please clone your HF Space first:"
echo " git clone https://huggingface.co/spaces/MatthewStroud/AI_Personas"
exit 1
fi
# Check if it's a git repository
if [ ! -d "$HF_DIR/.git" ]; then
echo "❌ Error: $HF_DIR is not a git repository"
echo "Please clone your HF Space using git clone"
exit 1
fi
echo "πŸ“ Target directory: $HF_DIR"
echo ""
# Copy directories
echo "πŸ“¦ Copying directories..."
cp -r data/ "$HF_DIR/"
echo " βœ“ data/"
cp -r pages/ "$HF_DIR/"
echo " βœ“ pages/"
cp -r src/ "$HF_DIR/"
echo " βœ“ src/"
cp -r .streamlit/ "$HF_DIR/"
echo " βœ“ .streamlit/"
# Copy main app file
echo ""
echo "πŸ“„ Copying main files..."
cp web_app.py "$HF_DIR/"
echo " βœ“ web_app.py"
# Copy requirements (rename for HF)
cp requirements_hf.txt "$HF_DIR/requirements.txt"
echo " βœ“ requirements.txt (from requirements_hf.txt)"
# Copy README (rename for HF)
cp README_HF.md "$HF_DIR/README.md"
echo " βœ“ README.md (from README_HF.md)"
# Copy .gitignore
cp .gitignore_hf "$HF_DIR/.gitignore"
echo " βœ“ .gitignore"
echo ""
echo "βœ… All files copied successfully!"
echo ""
echo "πŸ“ Next steps:"
echo " 1. cd $HF_DIR"
echo " 2. git status # Review what will be committed"
echo " 3. git add ."
echo " 4. git commit -m \"Initial deployment of AI Personas with Be.FM\""
echo " 5. git push"
echo ""
echo "⏱️ The Space will build in 5-10 minutes after pushing."
echo "🌐 View your Space at: https://huggingface.co/spaces/MatthewStroud/AI_Personas"
echo ""
echo "πŸ’‘ Tips:"
echo " - First Be.FM load will take 2-3 minutes (downloading model)"
echo " - T4 GPU costs ~$0.60/hour when Space is running"
echo " - Pause the Space in Settings when not in use to save costs"
echo ""