Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add Dockerfile and sync_hf_space
  • Loading branch information
daavoo committed Jan 17, 2025
commit d1d7360bc385e28f19f505317ab1210f59235bfa
40 changes: 40 additions & 0 deletions .github/workflows/sync_hf_space.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Sync to Hugging Face Space

on:
release:
types: [published]
workflow_dispatch:

jobs:
sync-space:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- run: git clone https://${{ secrets.HF_USERNAME }}:${{ secrets.HF_TOKEN }}@huggingface.co/spaces/mozilla-ai/structured-qa hf-space

- run: |
cp demo/app.py hf-space/app.py
cp demo/Dockerfile hf-space/Dockerfile

- run: |
cd hf-space
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
git add .
git commit -m "Sync with https://github.com/mozilla-ai/structured-qa"

- name: Push to Hugging Face
run: |
cd hf-space
git push https://${{ secrets.HF_USERNAME }}:${{ secrets.HF_TOKEN }}@huggingface.co/spaces/mozilla-ai/structured-qa main

- name: Reboot Space
if: always()
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
run: |
pip install huggingface_hub
python demo/reboot_space.py
26 changes: 26 additions & 0 deletions demo/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
FROM nvidia/cuda:12.2.2-cudnn8-devel-ubuntu22.04

RUN apt-get update && apt-get install --no-install-recommends -y \
build-essential \
python3.10 \
python3.10-dev \
python3-pip \
git \
&& apt-get clean && rm -rf /var/lib/apt/lists/*

RUN useradd -m -u 1000 user

USER user

ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH

WORKDIR $HOME/app

RUN pip3 install https://github.com/abetlen/llama-cpp-python/releases/download/v0.3.4-cu122/llama_cpp_python-0.3.4-cp310-cp310-linux_x86_64.whl
RUN pip3 install structured-qa

COPY --chown=user . $HOME/app

EXPOSE 8501
ENTRYPOINT ["streamlit", "run", "app.py", "--server.enableXsrfProtection", "false"]
Loading