Skip to content

[reading order] Improve reading order and add exporters #3478

[reading order] Improve reading order and add exporters

[reading order] Improve reading order and add exporters #3478

Workflow file for this run

name: demo
on:
# Run 'test-demo' on every pull request to the main branch
pull_request:
branches: [main]
# Run 'test-demo' on every push to the main branch or both jobs when a new version tag is pushed
push:
branches:
- main
tags:
- 'v*'
# Run 'sync-to-hub' on a scheduled cron job
schedule:
- cron: '0 2 10 * *' # At 02:00 on day-of-month 10 (every month)
# Allow manual triggering of the workflow
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
test-demo:
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python: ["3.11"]
steps:
- uses: actions/checkout@v7
- name: Setup environment
uses: ./.github/actions/setup-env
with:
python-version: ${{ matrix.python }}
extra-requirements: demo/pt-requirements.txt
- name: Run demo
run: |
streamlit --version
screen -dm streamlit run demo/app.py
sleep 10
curl http://localhost:8501/docs
# This job only runs when a new version tag is pushed or during the cron job or when manually triggered
sync-to-hub:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
needs: test-demo
runs-on: ${{ matrix.os }}
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python: ["3.11"]
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python }}
- name: Install huggingface_hub
run: pip install huggingface-hub
- name: Upload folder to Hugging Face
# Only keep the requirements.txt file for the demo (PyTorch)
run: |
mv demo/pt-requirements.txt demo/requirements.txt
python -c "
from huggingface_hub import HfApi
api = HfApi(token='${{ secrets.HF_TOKEN }}')
repo_id = 'mindee/doctr'
api.upload_folder(repo_id=repo_id, repo_type='space', folder_path='demo/')
api.restart_space(repo_id=repo_id, factory_reboot=True)
"