Deployment notes for Hugging Face Spaces
- HF_TOKEN secret
- Create a Hugging Face token at https://huggingface.co/settings/tokens
- Token should have repository write permissions (to create and push Spaces)
- In GitHub, go to Settings -> Secrets -> Actions -> New repository secret
- Name: HF_TOKEN
- Value:
- Streamlit compatibility
- The workflow creates the Space with
space_sdk='streamlit'so it will run as a Streamlit app. - Hugging Face Spaces will run
streamlit_app.pyorapp.pyby default; this repo containsstreamlit_app.pyto be explicit.
- System dependencies
- Some OCR engines require system packages (e.g., Tesseract binary, system libs for PaddlePaddle). Hugging Face's Streamlit SDK does not allow installing system packages.
- If you need system packages, use a Docker-based Space (set
space_sdk='docker'and add a Dockerfile that installs required system packages).
- LLM / Ollama
- The app optionally uses
ollamafor LLM features. Ollama is not installed by default in Spaces; LLM features will be disabled ifollamaisn't present.
- Tesseract
- Ensure Tesseract is available in the environment or use the Docker approach to install it.
- Running CI/CD
- After pushing to
mainand settingHF_TOKENsecret, the GitHub Actions workflow.github/workflows/deploy_to_hf.ymlwill create the Space and upload the repository.
Note: This repository includes a Dockerfile and the CI workflow is configured to create a Docker-based Space (space_sdk='docker'). The Dockerfile installs system dependencies such as Tesseract so the OCR engines can run inside the Space container.
- Troubleshooting
- If the deployment fails, open the Actions run logs to see the error and adjust the workflow or repository accordingly.