added HF token env in dockerfile and app.py
Browse files- .gitignore +3 -0
- Dockerfile +8 -0
- requirements.txt +2 -1
.gitignore
CHANGED
|
@@ -1 +1,4 @@
|
|
| 1 |
*Zone.Identifier
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
*Zone.Identifier
|
| 2 |
+
.env
|
| 3 |
+
*.env
|
| 4 |
+
.env.local
|
Dockerfile
CHANGED
|
@@ -9,6 +9,9 @@ RUN apt-get update && apt-get install -y \
|
|
| 9 |
git \
|
| 10 |
&& rm -rf /var/lib/apt/lists/*
|
| 11 |
|
|
|
|
|
|
|
|
|
|
| 12 |
COPY requirements.txt ./
|
| 13 |
COPY models/ ./models/
|
| 14 |
COPY pages/ ./pages/
|
|
@@ -16,6 +19,11 @@ COPY images/ ./images/
|
|
| 16 |
COPY app.py ./
|
| 17 |
COPY .streamlit/ ./.streamlit/
|
| 18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
RUN useradd -m myuser
|
| 20 |
USER myuser
|
| 21 |
ENV PATH="/home/myuser/.local/bin:${PATH}"
|
|
|
|
| 9 |
git \
|
| 10 |
&& rm -rf /var/lib/apt/lists/*
|
| 11 |
|
| 12 |
+
# Создание кеш-директорий
|
| 13 |
+
RUN mkdir -p /app/.cache/huggingface /app/.cache/datasets /app/.cache/transformers
|
| 14 |
+
|
| 15 |
COPY requirements.txt ./
|
| 16 |
COPY models/ ./models/
|
| 17 |
COPY pages/ ./pages/
|
|
|
|
| 19 |
COPY app.py ./
|
| 20 |
COPY .streamlit/ ./.streamlit/
|
| 21 |
|
| 22 |
+
# Настройка переменных окружения (без токена)
|
| 23 |
+
ENV HF_HOME=/app/.cache/huggingface
|
| 24 |
+
ENV HF_DATASETS_CACHE=/app/.cache/datasets
|
| 25 |
+
ENV TRANSFORMERS_CACHE=/app/.cache/transformers
|
| 26 |
+
|
| 27 |
RUN useradd -m myuser
|
| 28 |
USER myuser
|
| 29 |
ENV PATH="/home/myuser/.local/bin:${PATH}"
|
requirements.txt
CHANGED
|
@@ -6,4 +6,5 @@ torch
|
|
| 6 |
torchmetrics
|
| 7 |
transformers
|
| 8 |
streamlit
|
| 9 |
-
st-pages
|
|
|
|
|
|
| 6 |
torchmetrics
|
| 7 |
transformers
|
| 8 |
streamlit
|
| 9 |
+
st-pages
|
| 10 |
+
huggingface_hub
|