Spaces:
Sleeping
Sleeping
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 "======================================================" |