Spaces:
Running on Zero
Running on Zero
Download deploy_to_hf.sh from Varun2007/document-qa-system: direct link, hf CLI and curl.
- Browser
- Download file 1.73 kB
-
https://huggingface.co/spaces/Varun2007/document-qa-system/resolve/main/deploy_to_hf.sh
- Command line
-
hf download hf://spaces/Varun2007/document-qa-system/deploy_to_hf.sh
-
curl -L -o deploy_to_hf.sh https://huggingface.co/spaces/Varun2007/document-qa-system/resolve/main/deploy_to_hf.sh
1.73 kB
| # Deploy to Hugging Face Spaces Automation Script | |
| # Usage: ./deploy_to_hf.sh <hf_username>/<space_name> | |
| set -e | |
| if [ -z "$1" ]; then | |
| echo "Usage: ./deploy_to_hf.sh <hf_username>/<space_name>" | |
| echo "Example: ./deploy_to_hf.sh ramakrishna/document-qa" | |
| exit 1 | |
| fi | |
| SPACE_REPO="$1" | |
| SPACE_URL="https://huggingface.co/spaces/$SPACE_REPO" | |
| echo "==========================================================" | |
| echo "Preparing deployment to Hugging Face Space: $SPACE_REPO" | |
| echo "==========================================================" | |
| # Check git | |
| if ! command -v git &> /dev/null; then | |
| echo "Error: git is not installed." | |
| exit 1 | |
| fi | |
| # Ensure git is initialized locally | |
| if [ ! -d ".git" ]; then | |
| echo "Initializing local git repository..." | |
| git init | |
| git branch -M main | |
| fi | |
| # Ensure sample documents exist | |
| if [ ! -f "data/sample_financial_report.pdf" ]; then | |
| echo "Generating sample documents..." | |
| python3 create_sample_docs.py | |
| fi | |
| # Set remote | |
| echo "Setting git remote 'space' -> $SPACE_URL.git" | |
| git remote remove space 2>/dev/null || true | |
| git remote add space "$SPACE_URL.git" | |
| # Add files | |
| echo "Staging files..." | |
| git add app.py config.py ingest.py retrieve.py generate.py verify.py evaluate.py | |
| git add create_sample_docs.py requirements.txt packages.txt README.md .gitignore | |
| git add data/ | |
| git commit -m "Deploy Production Document QA system to Hugging Face Space" || true | |
| echo "Pushing to Hugging Face Spaces (main branch)..." | |
| git push -u space main | |
| echo "==========================================================" | |
| echo "Successfully pushed to Hugging Face Spaces!" | |
| echo "View your live app at: $SPACE_URL" | |
| echo "==========================================================" | |