Spaces:
Runtime error
Runtime error
Upload 2 files
Browse files- Dockerfile +9 -3
- requirements.txt +6 -7
Dockerfile
CHANGED
|
@@ -4,12 +4,17 @@ WORKDIR /code
|
|
| 4 |
|
| 5 |
COPY ./requirements.txt /code/requirements.txt
|
| 6 |
|
| 7 |
-
|
|
|
|
| 8 |
|
| 9 |
-
|
|
|
|
| 10 |
|
|
|
|
|
|
|
| 11 |
USER user
|
| 12 |
|
|
|
|
| 13 |
ENV HOME=/home/user \
|
| 14 |
PATH=/home/user/.local/bin:${PATH}
|
| 15 |
|
|
@@ -17,4 +22,5 @@ WORKDIR $HOME/app
|
|
| 17 |
|
| 18 |
COPY --chown=user . $HOME/app
|
| 19 |
|
| 20 |
-
|
|
|
|
|
|
| 4 |
|
| 5 |
COPY ./requirements.txt /code/requirements.txt
|
| 6 |
|
| 7 |
+
# Upgrade pip before installing requirements
|
| 8 |
+
RUN pip install --no-cache-dir --upgrade pip
|
| 9 |
|
| 10 |
+
# Install dependencies
|
| 11 |
+
RUN pip install --no-cache-dir -r /code/requirements.txt
|
| 12 |
|
| 13 |
+
# Create and use non-root user
|
| 14 |
+
RUN useradd -m user
|
| 15 |
USER user
|
| 16 |
|
| 17 |
+
# Set environment variables
|
| 18 |
ENV HOME=/home/user \
|
| 19 |
PATH=/home/user/.local/bin:${PATH}
|
| 20 |
|
|
|
|
| 22 |
|
| 23 |
COPY --chown=user . $HOME/app
|
| 24 |
|
| 25 |
+
# Run the application
|
| 26 |
+
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
requirements.txt
CHANGED
|
@@ -1,11 +1,10 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
sentencepiece==0.2.0 # Use version required by mistral-common
|
| 6 |
torch>=1.13.0
|
| 7 |
transformers==4.28.0
|
| 8 |
numpy<2
|
| 9 |
peft==0.11.1
|
| 10 |
-
huggingface-hub
|
| 11 |
-
mistral-common==1.3.0
|
|
|
|
| 1 |
+
fastapi==0.95.0
|
| 2 |
+
requests==2.28.2
|
| 3 |
+
uvicorn[standard]==0.20.0
|
| 4 |
+
sentencepiece==0.2.0
|
|
|
|
| 5 |
torch>=1.13.0
|
| 6 |
transformers==4.28.0
|
| 7 |
numpy<2
|
| 8 |
peft==0.11.1
|
| 9 |
+
huggingface-hub>=0.17.0
|
| 10 |
+
mistral-common==1.3.0
|