Skip to content

Add text summarization with LLM for the narrator demo #1389

Add text summarization with LLM for the narrator demo

Add text summarization with LLM for the narrator demo #1389

name: Sanity check (AI ref kits)
on:
schedule:
- cron: "0 2 * * *"
pull_request:
branches: [master]
push:
branches: [master]
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
find-subprojects:
runs-on: ubuntu-latest
outputs:
gradio: ${{ steps.categorize-subprojects.outputs.gradio }}
webcam: ${{ steps.categorize-subprojects.outputs.webcam }}
python: ${{ steps.categorize-subprojects.outputs.python }}
notebook: ${{ steps.categorize-subprojects.outputs.notebook }}
steps:
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Determine subprojects to test
id: find-updates
uses: ./.github/reusable-steps/find-updates
with:
dir: ai_ref_kits
ci_config_file: sanity-check-kits.yml
- name: Categorize subprojects
id: categorize-subprojects
uses: ./.github/reusable-steps/categorize-projects
with:
subprojects: ${{ steps.find-updates.outputs.subproject_dirs }}
gradio:
needs: find-subprojects
if: ${{ needs.find-subprojects.outputs.gradio != '[]' }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04, ubuntu-24.04-arm, windows-2025]
python: ["3.10", "3.13"]
subproject: ${{ fromJson(needs.find-subprojects.outputs.gradio) }}
steps:
- uses: actions/checkout@v4
- uses: ./.github/reusable-steps/setup-os
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- uses: ./.github/reusable-steps/setup-python
with:
python: ${{ matrix.python }}
project: ${{ matrix.subproject }}
- uses: ./.github/reusable-steps/setup-hugging-face
with:
hf_token: ${{ secrets.HF_TOKEN }}
- name: Check if test file exists
id: determine-script
shell: bash
run: |
if [[ -f "${{ matrix.subproject }}/ci/test.py" ]]; then
echo "script=ci/test.py" >> "$GITHUB_ENV"
else
echo "script=main.py" >> "$GITHUB_ENV"
fi
- uses: ./.github/reusable-steps/gradio-action
with:
script: ${{ env.script }}
project: ${{ matrix.subproject }}
webcam:
needs: find-subprojects
if: ${{ needs.find-subprojects.outputs.webcam != '[]' }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04, ubuntu-24.04-arm, windows-2025]
python: ["3.10", "3.13"]
subproject: ${{ fromJson(needs.find-subprojects.outputs.webcam) }}
steps:
- uses: actions/checkout@v4
- uses: ./.github/reusable-steps/setup-os
- uses: ./.github/reusable-steps/setup-python
with:
python: ${{ matrix.python }}
project: ${{ matrix.subproject }}
- name: Run Webcam Demo
shell: bash
timeout-minutes: 30
run: |
cd ${{ matrix.subproject }}
# linux requires a virtual display
if [ "${{ runner.os }}" == "Linux" ]; then
xvfb-run python main.py --stream sample_video.mp4
else
python main.py --stream sample_video.mp4
fi
python:
needs: find-subprojects
if: ${{ needs.find-subprojects.outputs.python != '[]' }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04, ubuntu-24.04-arm, windows-2025]
python: ["3.10", "3.13"]
subproject: ${{ fromJson(needs.find-subprojects.outputs.python) }}
steps:
- uses: actions/checkout@v4
- uses: ./.github/reusable-steps/setup-os
- uses: ./.github/reusable-steps/setup-python
with:
python: ${{ matrix.python }}
project: ${{ matrix.subproject }}
- name: Run Python
shell: bash
timeout-minutes: 10
run: |
cd ${{ matrix.subproject }}
python main.py
notebook:
needs: find-subprojects
if: ${{ needs.find-subprojects.outputs.notebook != '[]' }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04, ubuntu-24.04-arm, windows-2025]
python: ["3.10", "3.13"]
subproject: ${{ fromJson(needs.find-subprojects.outputs.notebook) }}
steps:
- uses: actions/checkout@v4
- uses: ./.github/reusable-steps/setup-os
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- uses: ./.github/reusable-steps/setup-python
with:
python: ${{ matrix.python }}
project: ${{ matrix.subproject }}
- name: Run Notebook
shell: bash
timeout-minutes: 30
run: |
cd ${{ matrix.subproject }}
jupyter nbconvert --to notebook --debug --execute *.ipynb