Spaces:
				
			
			
	
			
			
		Sleeping
		
	
	
	
			
			
	
	
	
	
		
		
		Sleeping
		
	| # Hugging Face Deployment Preparation Script | |
| # This script prepares your app for deployment to Hugging Face Spaces | |
| set -e # Exit on error | |
| echo "π Preparing for Hugging Face Spaces Deployment" | |
| echo "================================================" | |
| echo "" | |
| # Check if we're in the right directory | |
| if [ ! -f "app_hf.py" ]; then | |
| echo "β Error: Must run from project root (where app_hf.py is located)" | |
| exit 1 | |
| fi | |
| # Step 1: Copy HF-specific files | |
| echo "π Step 1: Copying HF-specific files..." | |
| cp Dockerfile.hf Dockerfile | |
| echo " β Copied Dockerfile.hf β Dockerfile" | |
| cp README_HF.md README.md | |
| echo " β Copied README_HF.md β README.md" | |
| # Step 2: Verify required files exist | |
| echo "" | |
| echo "π Step 2: Verifying required files..." | |
| required_files=("Dockerfile" "README.md" "requirements.txt" "app_hf.py" "wsgi.py" ".gitignore" "app/__init__.py") | |
| for file in "${required_files[@]}"; do | |
| if [ -f "$file" ] || [ -d "$file" ]; then | |
| echo " β $file" | |
| else | |
| echo " β Missing: $file" | |
| exit 1 | |
| fi | |
| done | |
| # Step 3: Check app/ directory | |
| echo "" | |
| echo "π Step 3: Checking app directory structure..." | |
| app_dirs=("app/routes" "app/models" "app/templates" "app/fine_tuning") | |
| for dir in "${app_dirs[@]}"; do | |
| if [ -d "$dir" ]; then | |
| echo " β $dir/" | |
| else | |
| echo " β οΈ Warning: $dir/ not found" | |
| fi | |
| done | |
| # Step 4: Verify port configuration | |
| echo "" | |
| echo "π Step 4: Verifying port 7860 configuration..." | |
| if grep -q "7860" Dockerfile && grep -q "7860" app_hf.py; then | |
| echo " β Port 7860 configured correctly" | |
| else | |
| echo " β Port 7860 not found in Dockerfile or app_hf.py" | |
| exit 1 | |
| fi | |
| # Step 5: Check for sensitive files | |
| echo "" | |
| echo "π Step 5: Checking for sensitive files..." | |
| if [ -f ".env" ]; then | |
| echo " β οΈ WARNING: .env file exists - DO NOT upload to HF!" | |
| echo " Use HF Secrets instead for FLASK_SECRET_KEY" | |
| fi | |
| if [ -f "instance/participatory_planner.db" ]; then | |
| echo " β οΈ Local database exists - will NOT be uploaded (good)" | |
| fi | |
| # Step 6: Generate deployment summary | |
| echo "" | |
| echo "π Step 6: Deployment Summary" | |
| echo "=============================" | |
| echo "" | |
| echo "Ready to deploy to Hugging Face Spaces!" | |
| echo "" | |
| echo "π¦ Files ready for upload:" | |
| echo " - Dockerfile (HF version)" | |
| echo " - README.md (with YAML header)" | |
| echo " - requirements.txt" | |
| echo " - app_hf.py" | |
| echo " - wsgi.py" | |
| echo " - app/ directory" | |
| echo " - .gitignore" | |
| echo "" | |
| echo "π IMPORTANT - Configure these secrets in HF Space Settings:" | |
| echo " Secret Name: FLASK_SECRET_KEY" | |
| echo " Secret Value: 9fd11d101e36efbd3a7893f56d604b860403d247633547586c41453118e69b00" | |
| echo "" | |
| echo "π Next steps:" | |
| echo " 1. Go to https://huggingface.co/new-space" | |
| echo " 2. Choose SDK: Docker" | |
| echo " 3. Upload the files listed above" | |
| echo " 4. Add FLASK_SECRET_KEY to Secrets" | |
| echo " 5. Wait for build (~10 minutes first time)" | |
| echo "" | |
| echo "π For detailed instructions, see:" | |
| echo " - HF_DEPLOYMENT_CHECKLIST.md" | |
| echo " - HUGGINGFACE_DEPLOYMENT.md" | |
| echo "" | |
| echo "β Preparation complete! Ready to deploy! π" | |