Spaces:
Runtime error
Runtime error
Commit ·
31e92d3
1
Parent(s): e0f018b
newone
Browse files- Dockerfile +40 -0
- requirements.txt +10 -10
- setup.sh +0 -7
Dockerfile
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Use an official Python runtime as a parent image
|
| 2 |
+
FROM python:3.9-slim
|
| 3 |
+
|
| 4 |
+
# Set the working directory in the container
|
| 5 |
+
WORKDIR /app
|
| 6 |
+
|
| 7 |
+
# Copy the current directory contents into the container at /app
|
| 8 |
+
ADD . /app
|
| 9 |
+
|
| 10 |
+
# Install the necessary build tools
|
| 11 |
+
RUN apt-get update && \
|
| 12 |
+
apt-get install -y gcc g++ python3-dev && \
|
| 13 |
+
apt-get clean
|
| 14 |
+
|
| 15 |
+
# Create writable cache and surprise data directories
|
| 16 |
+
RUN mkdir -p /app/.cache /app/.surprise_data /tmp
|
| 17 |
+
|
| 18 |
+
# Set environment variables for cache directories
|
| 19 |
+
ENV HF_HOME=/app/.cache
|
| 20 |
+
ENV HF_DATASETS_CACHE=/app/.cache
|
| 21 |
+
ENV TRANSFORMERS_CACHE=/app/.cache
|
| 22 |
+
ENV SURPRISE_DATA_FOLDER=/app/.surprise_data
|
| 23 |
+
|
| 24 |
+
# Update pip and install specific versions of numpy and other necessary packages
|
| 25 |
+
RUN pip install --upgrade pip && \
|
| 26 |
+
pip install --no-cache-dir "numpy<2" && \
|
| 27 |
+
pip install --no-cache-dir -r requirements.txt
|
| 28 |
+
|
| 29 |
+
# Ensure /tmp is writable, as the app will create the label encoder file there
|
| 30 |
+
# Ensure the cache directory is writable
|
| 31 |
+
# Ensure the cache directory is writable
|
| 32 |
+
RUN mkdir -p /app/cache && chmod -R 777 /app/cache /tmp
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
# Expose port 5016 for the Flask app
|
| 37 |
+
EXPOSE 5016
|
| 38 |
+
|
| 39 |
+
# Run app.py when the container launches
|
| 40 |
+
CMD ["gunicorn", "-b", "0.0.0.0:7860","app:app"]
|
requirements.txt
CHANGED
|
@@ -1,10 +1,10 @@
|
|
| 1 |
-
pandas
|
| 2 |
-
pickle-mixin
|
| 3 |
-
flask
|
| 4 |
-
flask-cors
|
| 5 |
-
pyngrok
|
| 6 |
-
scikit-learn
|
| 7 |
-
torch
|
| 8 |
-
transformers
|
| 9 |
-
|
| 10 |
-
gunicorn
|
|
|
|
| 1 |
+
pandas
|
| 2 |
+
pickle-mixin
|
| 3 |
+
flask
|
| 4 |
+
flask-cors
|
| 5 |
+
pyngrok
|
| 6 |
+
scikit-learn
|
| 7 |
+
torch
|
| 8 |
+
transformers
|
| 9 |
+
surprise
|
| 10 |
+
gunicorn
|
setup.sh
DELETED
|
@@ -1,7 +0,0 @@
|
|
| 1 |
-
#!/bin/bash
|
| 2 |
-
|
| 3 |
-
# Ensure pip is up to date
|
| 4 |
-
pip install --upgrade pip
|
| 5 |
-
|
| 6 |
-
# Install required dependencies
|
| 7 |
-
pip install -r requirements.txt
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|