Add demo and CI job for auto update #10
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Sync Huging Face demo | |
on: | |
push: | |
# tags: | |
# - 'v*' | |
# pull_request: | |
# branches: main | |
# schedule: | |
# - cron: '0 2 29 * *' # At 02:00 on day-of-month 29 | |
jobs: | |
test-demo: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest] | |
python: ["3.9"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python }} | |
architecture: x64 | |
- name: Cache python modules | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pkg-deps-${{ matrix.python }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('demo/requirements.txt') }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r demo/requirements.txt --upgrade | |
- name: Start Gradio demo | |
run: | | |
nohup python demo/app.py & | |
sleep 10 # Allow some time for the Gradio server to start | |
- name: Check demo build | |
run: | | |
curl --fail http://127.0.0.1:7860/ || exit 1 | |
sync-to-hub: | |
needs: test-demo | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
# - name: Add remote | |
# env: | |
# HF_TOKEN: ${{ secrets.HF_SSH }} | |
# run: cd demo && git remote add space https://Felix92:[email protected]/spaces/Felix92/OnnxTR-OCR | |
- name: Push to hub | |
env: | |
HF: ${{ secrets.HF_SSH }} | |
run: | | |
cd demo | |
git config --global user.email "felixdittrich92@gmailcom" | |
git config --global user.name "Felix92" | |
git checkout -b main | |
git add . | |
git commit -m "Sync hf demo" --allow-empty | |
git push --force https://Felix92:$HF_TOKEN:[email protected]/spaces/Felix92/OnnxTR-OCR main | |