Spaces:
Sleeping
Sleeping
File size: 1,946 Bytes
8e66145 |
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 |
#!/bin/bash
set -e
echo "Setting up deployment to Hugging Face Spaces..."
# Check if git is installed
if ! command -v git &> /dev/null; then
echo "Error: git is not installed. Please install git first."
exit 1
fi
# Check if git-lfs is installed
if ! command -v git-lfs &> /dev/null; then
echo "Error: git-lfs is not installed. Please install git-lfs first."
echo "You can install it with: brew install git-lfs (Mac) or sudo apt-get install git-lfs (Linux)"
exit 1
fi
# Initialize Git LFS
echo "Initializing Git LFS..."
git lfs install
# Create a new orphaned branch
echo "Creating new orphaned branch 'hf-deployment'..."
git checkout --orphan hf-deployment
# Remove all files from staging
echo "Clearing staging area..."
git rm -rf --cached .
# Keep the .gitattributes and .gitignore files
echo "Adding .gitattributes and .gitignore..."
git add .gitattributes .gitignore
# Make sure the LFS tracking is set up correctly
echo "Setting up LFS tracking for large files..."
git lfs track "*.sqlite3"
git lfs track "*.pkl"
git lfs track "*.bin"
git lfs track "mental_health_model_artifacts/chroma_db/chroma.sqlite3"
git lfs track "mental_health_model_artifacts/chroma_db/**/*.bin"
git lfs track "mental_health_model_artifacts/**/*.pkl"
# Add all files
echo "Adding all files to staging..."
git add .
# Commit the changes
echo "Committing changes..."
git commit -m "Initial deployment with Git LFS enabled"
echo "======================================================"
echo "Setup complete! To push to Hugging Face Spaces, run:"
echo "git push -u origin hf-deployment --force"
echo ""
echo "If this is successful and you want to make this the main branch:"
echo "1. Go to Hugging Face Spaces and set 'hf-deployment' as the default branch"
echo "2. Rename the branch locally: git branch -m hf-deployment main"
echo "3. Push to origin: git push -u origin main"
echo "======================================================" |