Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +9 -25
Dockerfile
CHANGED
@@ -1,17 +1,16 @@
|
|
1 |
# Base image with Python and common dependencies
|
2 |
FROM python:3.10-slim
|
3 |
|
4 |
-
# Set working directory
|
5 |
WORKDIR /app
|
6 |
|
7 |
-
# Set environment variables
|
8 |
ENV DEBIAN_FRONTEND=noninteractive \
|
9 |
PYTHONUNBUFFERED=1 \
|
10 |
PYTHONDONTWRITEBYTECODE=1 \
|
11 |
TRANSFORMERS_CACHE=/app/cache \
|
12 |
-
HF_HOME=/app/cache
|
|
|
|
|
13 |
|
14 |
-
# COPY requirements file and install Python dependencies
|
15 |
COPY requirements.txt requirements.txt
|
16 |
COPY extract_img_pdf.py extract_img_pdf.py
|
17 |
COPY live_streaming_flask.py live_streaming_flask.py
|
@@ -19,6 +18,7 @@ COPY templates/ /app/templates
|
|
19 |
COPY .env .env
|
20 |
COPY test_streaming.py test_streaming.py
|
21 |
COPY app_main.py app_main.py
|
|
|
22 |
|
23 |
# Install system dependencies
|
24 |
RUN apt-get update && apt-get install -y \
|
@@ -39,28 +39,12 @@ RUN apt-get update && apt-get install -y \
|
|
39 |
|
40 |
RUN pip install --upgrade pip && pip install -r requirements.txt
|
41 |
|
42 |
-
#
|
43 |
-
|
44 |
-
|
|
|
|
|
45 |
|
46 |
-
# Set writable path for nltk data
|
47 |
-
ENV NLTK_DATA=/app/nltk_data
|
48 |
-
RUN mkdir -p /app/nltk_data
|
49 |
-
|
50 |
-
# Pre-download required NLTK models
|
51 |
-
RUN python -m nltk.downloader -d /app/nltk_data \
|
52 |
-
punkt averaged_perceptron_tagger averaged_perceptron_tagger_eng
|
53 |
-
|
54 |
-
RUN mkdir -p /app/cache /app/data && chmod -R 777 /app/cache /app/data
|
55 |
-
RUN mkdir -p /app/OUTPUTS
|
56 |
-
RUN mkdir -p /app/outputs
|
57 |
-
|
58 |
-
RUN mkdir -p outputs/DETECTED_IMAGE outputs/SCANNED_IMAGE outputs/EXTRACTED_JSON
|
59 |
-
|
60 |
-
# Expose the required port for HF Spaces
|
61 |
EXPOSE 7860
|
62 |
|
63 |
-
# Set the command to run your Flask app
|
64 |
-
# CMD ["python", "extract_img_pdf.py"]
|
65 |
-
# CMD ["python", "live_streaming_flask.py"]
|
66 |
CMD ["python", "app_main.py"]
|
|
|
1 |
# Base image with Python and common dependencies
|
2 |
FROM python:3.10-slim
|
3 |
|
|
|
4 |
WORKDIR /app
|
5 |
|
|
|
6 |
ENV DEBIAN_FRONTEND=noninteractive \
|
7 |
PYTHONUNBUFFERED=1 \
|
8 |
PYTHONDONTWRITEBYTECODE=1 \
|
9 |
TRANSFORMERS_CACHE=/app/cache \
|
10 |
+
HF_HOME=/app/cache \
|
11 |
+
NLTK_DATA=/app/nltk_data \
|
12 |
+
MPLCONFIGDIR=/app/.config/matplotlib
|
13 |
|
|
|
14 |
COPY requirements.txt requirements.txt
|
15 |
COPY extract_img_pdf.py extract_img_pdf.py
|
16 |
COPY live_streaming_flask.py live_streaming_flask.py
|
|
|
18 |
COPY .env .env
|
19 |
COPY test_streaming.py test_streaming.py
|
20 |
COPY app_main.py app_main.py
|
21 |
+
COPY compare_image_similarity_openclip.py compare_image_similarity_openclip.py
|
22 |
|
23 |
# Install system dependencies
|
24 |
RUN apt-get update && apt-get install -y \
|
|
|
39 |
|
40 |
RUN pip install --upgrade pip && pip install -r requirements.txt
|
41 |
|
42 |
+
# Create writable paths
|
43 |
+
RUN mkdir -p /app/nltk_data /app/.config/matplotlib \
|
44 |
+
&& mkdir -p /app/cache /app/data /app/OUTPUTS /app/outputs \
|
45 |
+
&& mkdir -p /app/outputs/DETECTED_IMAGE /app/outputs/SCANNED_IMAGE /app/outputs/EXTRACTED_JSON \
|
46 |
+
&& chmod -R 777 /app
|
47 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
EXPOSE 7860
|
49 |
|
|
|
|
|
|
|
50 |
CMD ["python", "app_main.py"]
|