Spaces:
Runtime error
Runtime error
gamingflexer
commited on
Commit
·
e1471fd
1
Parent(s):
5429c6f
Add GitHub workflows and Dockerfile for syncing to Hugging Face hub
Browse files- .github/workflows/file_size_check.yml +16 -0
- .github/workflows/main.yml +23 -0
- .gitignore +1 -0
- DockerFile +35 -0
.github/workflows/file_size_check.yml
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: Check file size
|
| 2 |
+
on:
|
| 3 |
+
pull_request:
|
| 4 |
+
branches: [main]
|
| 5 |
+
|
| 6 |
+
# to run this workflow manually from the Actions tab
|
| 7 |
+
workflow_dispatch:
|
| 8 |
+
|
| 9 |
+
jobs:
|
| 10 |
+
sync-to-hub:
|
| 11 |
+
runs-on: ubuntu-latest
|
| 12 |
+
steps:
|
| 13 |
+
- name: Check large files
|
| 14 |
+
uses: ActionsDesk/lfs-warning@v2.0
|
| 15 |
+
with:
|
| 16 |
+
filesizelimit: 10485760 # this is 10MB so we can sync to HF Spaces
|
.github/workflows/main.yml
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: Sync to Hugging Face hub
|
| 2 |
+
on:
|
| 3 |
+
push:
|
| 4 |
+
branches: [main]
|
| 5 |
+
|
| 6 |
+
# to run this workflow manually from the Actions tab
|
| 7 |
+
workflow_dispatch:
|
| 8 |
+
|
| 9 |
+
jobs:
|
| 10 |
+
sync-to-hub:
|
| 11 |
+
runs-on: ubuntu-latest
|
| 12 |
+
steps:
|
| 13 |
+
- uses: actions/checkout@v2
|
| 14 |
+
with:
|
| 15 |
+
fetch-depth: 0
|
| 16 |
+
- name: Add remote
|
| 17 |
+
env:
|
| 18 |
+
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
| 19 |
+
run: git remote add space https://asach:$HF_TOKEN@huggingface.co/spaces/asach/Catalog-Digitization
|
| 20 |
+
- name: Push to hub
|
| 21 |
+
env:
|
| 22 |
+
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
| 23 |
+
run: git push --force https://asach:$HF_TOKEN@huggingface.co/spaces/asach/Catalog-Digitization main
|
.gitignore
CHANGED
|
@@ -173,3 +173,4 @@ src/app/api/migrations/0005_alter_database_barcode_alter_database_brand_and_more
|
|
| 173 |
src/app/api/migrations/0006_alter_product_barcode_alter_product_brand_and_more.py
|
| 174 |
src/app/api/migrations/0007_alter_product_price.py
|
| 175 |
src/app/media/images/*
|
|
|
|
|
|
| 173 |
src/app/api/migrations/0006_alter_product_barcode_alter_product_brand_and_more.py
|
| 174 |
src/app/api/migrations/0007_alter_product_price.py
|
| 175 |
src/app/media/images/*
|
| 176 |
+
src/app/api/module/image.ipynb
|
DockerFile
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
ARG OPENAI_API_KEY
|
| 2 |
+
ARG SEVER_IP
|
| 3 |
+
|
| 4 |
+
FROM python:3.9
|
| 5 |
+
|
| 6 |
+
WORKDIR /code
|
| 7 |
+
|
| 8 |
+
COPY ./requirements.txt /code/requirements.txt
|
| 9 |
+
|
| 10 |
+
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
| 11 |
+
|
| 12 |
+
# Set up a new user named "user" with user ID 1000
|
| 13 |
+
RUN useradd -m -u 1000 user
|
| 14 |
+
|
| 15 |
+
# Switch to the "user" user
|
| 16 |
+
USER user
|
| 17 |
+
|
| 18 |
+
# Set home to the user's home directory
|
| 19 |
+
ENV HOME=/home/user \
|
| 20 |
+
PATH=/home/user/.local/bin:$PATH \
|
| 21 |
+
OPENAI_API_KEY=$OPENAI_API_KEY \
|
| 22 |
+
SEVER_IP=$SEVER_IP
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
# Set the working directory to the user's home directory
|
| 26 |
+
WORKDIR $HOME/app
|
| 27 |
+
|
| 28 |
+
# Copy the current directory contents into the container at $HOME/app setting the owner to the user
|
| 29 |
+
COPY --chown=user . $HOME/app
|
| 30 |
+
|
| 31 |
+
ENV GRADIO_SERVER_NAME=0.0.0.0
|
| 32 |
+
|
| 33 |
+
EXPOSE 7860
|
| 34 |
+
|
| 35 |
+
CMD ["python", "src/app.py"]
|