Spaces:
Running
Running
Update dependencies and fix build issues
Browse files- Updated package versions in requirements.txt for better compatibility
- Improved dependency management in setup.py
- Enhanced Dockerfile with better system dependencies and caching
- Added specific versions for all dependencies to ensure reproducibility
- Fixed auto-gptq version compatibility issue
- Dockerfile +21 -10
- requirements.txt +29 -31
- setup.py +35 -20
Dockerfile
CHANGED
@@ -6,9 +6,9 @@ ENV PYTHONUNBUFFERED=1 \
|
|
6 |
PYTHONHASHSEED=random \
|
7 |
PIP_NO_CACHE_DIR=1 \
|
8 |
PIP_DISABLE_PIP_VERSION_CHECK=1 \
|
9 |
-
PIP_DEFAULT_TIMEOUT=
|
10 |
-
|
11 |
-
|
12 |
|
13 |
# Install system dependencies
|
14 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
@@ -17,6 +17,12 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
17 |
git \
|
18 |
gcc \
|
19 |
g++ \
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
&& rm -rf /var/lib/apt/lists/*
|
21 |
|
22 |
# Set working directory
|
@@ -25,12 +31,22 @@ WORKDIR /app
|
|
25 |
# Install pip and setuptools
|
26 |
RUN pip install --upgrade pip setuptools wheel
|
27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
# Copy requirements first for better caching
|
29 |
COPY requirements.txt .
|
30 |
|
31 |
# Install Python dependencies
|
32 |
RUN pip install --no-cache-dir -r requirements.txt
|
33 |
|
|
|
|
|
|
|
|
|
34 |
# Copy application code
|
35 |
COPY . .
|
36 |
|
@@ -45,7 +61,8 @@ ENV HOST=0.0.0.0 \
|
|
45 |
PORT=8501 \
|
46 |
STREAMLIT_SERVER_PORT=8501 \
|
47 |
STREAMLIT_SERVER_HEADLESS=true \
|
48 |
-
STREAMLIT_BROWSER_GATHER_USAGE_STATS=false
|
|
|
49 |
|
50 |
# Expose port
|
51 |
EXPOSE 8501
|
@@ -54,11 +71,5 @@ EXPOSE 8501
|
|
54 |
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
|
55 |
CMD curl --fail http://localhost:8501/_stcore/health || exit 1
|
56 |
|
57 |
-
# Set PYTHONPATH to include the app directory
|
58 |
-
ENV PYTHONPATH="/app:${PYTHONPATH}"
|
59 |
-
|
60 |
-
# Install Playwright browsers
|
61 |
-
RUN playwright install --with-deps
|
62 |
-
|
63 |
# Command to run the Streamlit app
|
64 |
CMD ["streamlit", "run", "src/streamlit_app.py"]
|
|
|
6 |
PYTHONHASHSEED=random \
|
7 |
PIP_NO_CACHE_DIR=1 \
|
8 |
PIP_DISABLE_PIP_VERSION_CHECK=1 \
|
9 |
+
PIP_DEFAULT_TIMEOUT=300 \
|
10 |
+
MODEL_CACHE_DIR=/data/models \
|
11 |
+
DEBIAN_FRONTEND=noninteractive
|
12 |
|
13 |
# Install system dependencies
|
14 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
|
17 |
git \
|
18 |
gcc \
|
19 |
g++ \
|
20 |
+
libgl1 \
|
21 |
+
libglib2.0-0 \
|
22 |
+
libsm6 \
|
23 |
+
libxrender1 \
|
24 |
+
libxext6 \
|
25 |
+
libgl1-mesa-glx \
|
26 |
&& rm -rf /var/lib/apt/lists/*
|
27 |
|
28 |
# Set working directory
|
|
|
31 |
# Install pip and setuptools
|
32 |
RUN pip install --upgrade pip setuptools wheel
|
33 |
|
34 |
+
# Install system-level dependencies for Python packages
|
35 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
36 |
+
gcc \
|
37 |
+
python3-dev \
|
38 |
+
&& rm -rf /var/lib/apt/lists/*
|
39 |
+
|
40 |
# Copy requirements first for better caching
|
41 |
COPY requirements.txt .
|
42 |
|
43 |
# Install Python dependencies
|
44 |
RUN pip install --no-cache-dir -r requirements.txt
|
45 |
|
46 |
+
# Install Playwright and its dependencies
|
47 |
+
RUN pip install playwright==1.42.0 && \
|
48 |
+
playwright install --with-deps chromium
|
49 |
+
|
50 |
# Copy application code
|
51 |
COPY . .
|
52 |
|
|
|
61 |
PORT=8501 \
|
62 |
STREAMLIT_SERVER_PORT=8501 \
|
63 |
STREAMLIT_SERVER_HEADLESS=true \
|
64 |
+
STREAMLIT_BROWSER_GATHER_USAGE_STATS=false \
|
65 |
+
PYTHONPATH="/app:${PYTHONPATH}"
|
66 |
|
67 |
# Expose port
|
68 |
EXPOSE 8501
|
|
|
71 |
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
|
72 |
CMD curl --fail http://localhost:8501/_stcore/health || exit 1
|
73 |
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
# Command to run the Streamlit app
|
75 |
CMD ["streamlit", "run", "src/streamlit_app.py"]
|
requirements.txt
CHANGED
@@ -1,50 +1,48 @@
|
|
1 |
# Core Dependencies
|
2 |
-
streamlit
|
3 |
-
fastapi
|
4 |
-
uvicorn
|
5 |
-
python-dotenv
|
6 |
|
7 |
# AI/ML
|
8 |
-
numpy
|
9 |
-
torch
|
10 |
-
transformers
|
11 |
-
sentence-transformers
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
|
|
17 |
|
18 |
# Browser Automation
|
19 |
-
playwright
|
20 |
-
selenium
|
21 |
|
22 |
# Utilities
|
23 |
-
requests
|
24 |
-
python-multipart
|
25 |
-
pydantic
|
26 |
-
tqdm
|
27 |
-
nest-asyncio
|
28 |
|
29 |
# For file operations (platform specific)
|
30 |
-
python-magic
|
31 |
-
python-magic-bin
|
32 |
|
33 |
# For model inference
|
34 |
-
safetensors
|
35 |
|
36 |
# For async operations
|
37 |
-
anyio
|
38 |
-
|
39 |
-
# For monitoring and progress
|
40 |
-
tqdm==4.65.0
|
41 |
|
42 |
# For web server
|
43 |
-
gunicorn
|
|
|
|
|
|
|
44 |
|
45 |
# For data processing
|
46 |
pandas
|
47 |
-
numpy
|
48 |
-
|
49 |
-
# For model optimization
|
50 |
onnxruntime
|
|
|
1 |
# Core Dependencies
|
2 |
+
streamlit>=1.32.0,<2.0.0
|
3 |
+
fastapi>=0.68.0,<1.0.0
|
4 |
+
uvicorn>=0.15.0,<1.0.0
|
5 |
+
python-dotenv>=0.19.0,<2.0.0
|
6 |
|
7 |
# AI/ML
|
8 |
+
numpy>=1.24.0,<2.0.0
|
9 |
+
torch>=2.0.0,<3.0.0
|
10 |
+
transformers>=4.30.0,<5.0.0
|
11 |
+
sentence-transformers>=2.2.2,<3.0.0
|
12 |
+
# AutoGPTQ requires specific CUDA versions, so we'll use the latest compatible version
|
13 |
+
auto-gptq>=0.7.1,<0.8.0
|
14 |
+
accelerate>=0.20.0,<1.0.0
|
15 |
+
bitsandbytes>=0.41.0,<1.0.0
|
16 |
+
optimum>=1.12.0,<2.0.0
|
17 |
+
huggingface-hub>=0.16.0,<1.0.0
|
18 |
|
19 |
# Browser Automation
|
20 |
+
playwright>=1.42.0,<2.0.0
|
21 |
+
selenium>=4.16.0,<5.0.0
|
22 |
|
23 |
# Utilities
|
24 |
+
requests>=2.31.0,<3.0.0
|
25 |
+
python-multipart>=0.0.6,<1.0.0
|
26 |
+
pydantic>=2.0.0,<3.0.0
|
27 |
+
tqdm>=4.65.0,<5.0.0
|
28 |
+
nest-asyncio>=1.5.6,<2.0.0
|
29 |
|
30 |
# For file operations (platform specific)
|
31 |
+
python-magic>=0.4.27,<1.0.0
|
32 |
+
python-magic-bin>=0.4.14,<1.0.0; platform_system=="Windows"
|
33 |
|
34 |
# For model inference
|
35 |
+
safetensors>=0.4.0,<1.0.0
|
36 |
|
37 |
# For async operations
|
38 |
+
anyio>=3.7.1,<4.0.0
|
|
|
|
|
|
|
39 |
|
40 |
# For web server
|
41 |
+
gunicorn>=20.1.0,<21.0.0
|
42 |
+
|
43 |
+
# For browser automation
|
44 |
+
webdriver-manager>=4.0.0,<5.0.0
|
45 |
|
46 |
# For data processing
|
47 |
pandas
|
|
|
|
|
|
|
48 |
onnxruntime
|
setup.py
CHANGED
@@ -12,26 +12,41 @@ with open("README.md", "r", encoding="utf-8") as fh:
|
|
12 |
|
13 |
# Core dependencies that will always be installed
|
14 |
CORE_DEPS = [
|
15 |
-
|
16 |
-
'
|
17 |
-
'
|
18 |
-
'
|
19 |
-
'
|
20 |
-
'
|
21 |
-
|
22 |
-
|
23 |
-
'
|
24 |
-
'
|
25 |
-
'
|
26 |
-
'
|
27 |
-
'
|
28 |
-
'
|
29 |
-
'
|
30 |
-
'
|
31 |
-
'
|
32 |
-
'
|
33 |
-
|
34 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
]
|
36 |
|
37 |
setup(
|
|
|
12 |
|
13 |
# Core dependencies that will always be installed
|
14 |
CORE_DEPS = [
|
15 |
+
# Core web framework
|
16 |
+
'streamlit>=1.32.0,<2.0.0',
|
17 |
+
'fastapi>=0.68.0,<1.0.0',
|
18 |
+
'uvicorn>=0.15.0,<1.0.0',
|
19 |
+
'python-dotenv>=0.19.0,<2.0.0',
|
20 |
+
'gunicorn>=20.1.0,<21.0.0',
|
21 |
+
|
22 |
+
# AI/ML
|
23 |
+
'numpy>=1.24.0,<2.0.0',
|
24 |
+
'torch>=2.0.0,<3.0.0',
|
25 |
+
'transformers>=4.30.0,<5.0.0',
|
26 |
+
'sentence-transformers>=2.2.2,<3.0.0',
|
27 |
+
'auto-gptq>=0.7.1,<0.8.0',
|
28 |
+
'accelerate>=0.20.0,<1.0.0',
|
29 |
+
'bitsandbytes>=0.41.0,<1.0.0',
|
30 |
+
'optimum>=1.12.0,<2.0.0',
|
31 |
+
'huggingface-hub>=0.16.0,<1.0.0',
|
32 |
+
'safetensors>=0.4.0,<1.0.0',
|
33 |
+
|
34 |
+
# Browser Automation
|
35 |
+
'playwright>=1.42.0,<2.0.0',
|
36 |
+
'selenium>=4.16.0,<5.0.0',
|
37 |
+
'webdriver-manager>=4.0.0,<5.0.0',
|
38 |
+
|
39 |
+
# Utilities
|
40 |
+
'requests>=2.31.0,<3.0.0',
|
41 |
+
'python-multipart>=0.0.6,<1.0.0',
|
42 |
+
'pydantic>=2.0.0,<3.0.0',
|
43 |
+
'tqdm>=4.65.0,<5.0.0',
|
44 |
+
'nest-asyncio>=1.5.6,<2.0.0',
|
45 |
+
'anyio>=3.7.1,<4.0.0',
|
46 |
+
|
47 |
+
# File operations
|
48 |
+
'python-magic>=0.4.27,<1.0.0',
|
49 |
+
'python-magic-bin>=0.4.14,<1.0.0; platform_system=="Windows"',
|
50 |
]
|
51 |
|
52 |
setup(
|