Zeggai Abdellah commited on
Commit
8efef2c
·
1 Parent(s): d5f8cfd

fix the requirement file

Browse files
Files changed (3) hide show
  1. Dockerfile +17 -31
  2. rag_system.py +10 -10
  3. requirements.txt +14 -26
Dockerfile CHANGED
@@ -1,46 +1,32 @@
1
- # Use Python 3.9 slim base image for better compatibility
2
- FROM python:3.9-slim
3
 
4
- # Set environment variables
5
- ENV PYTHONUNBUFFERED=1
6
- ENV PYTHONDONTWRITEBYTECODE=1
7
 
8
  # Install system dependencies
9
  RUN apt-get update && apt-get install -y \
10
  build-essential \
11
  curl \
12
- software-properties-common \
13
- git \
14
  && rm -rf /var/lib/apt/lists/*
15
 
16
- # Create a non-root user for security
17
- RUN useradd -m -u 1000 user
18
- USER user
19
- ENV HOME=/home/user \
20
- PATH=/home/user/.local/bin:$PATH
21
-
22
- # Set working directory
23
- WORKDIR $HOME/app
24
-
25
- # Copy requirements first for better caching
26
- COPY --chown=user:user requirements.txt .
27
 
28
- # Install Python dependencies with better error handling
29
- RUN pip install --no-cache-dir --upgrade pip && \
30
- pip install --no-cache-dir --timeout 300 -r requirements.txt
31
 
32
- # Copy all application files
33
- COPY --chown=user:user . .
34
 
35
- # Create necessary directories
36
  RUN mkdir -p data chroma_db_multilingual
37
 
38
- # Expose port 7860 (Hugging Face Spaces default)
39
- EXPOSE 7860
 
40
 
41
- # Health check
42
- HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
43
- CMD curl -f http://localhost:7860/health || exit 1
44
 
45
- # Run the FastAPI application
46
- CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]
 
1
+ # Use Python 3.11 slim image
2
+ FROM python:3.11-slim
3
 
4
+ # Set working directory
5
+ WORKDIR /app
 
6
 
7
  # Install system dependencies
8
  RUN apt-get update && apt-get install -y \
9
  build-essential \
10
  curl \
 
 
11
  && rm -rf /var/lib/apt/lists/*
12
 
13
+ # Copy requirements first (for better caching)
14
+ COPY requirements.txt .
 
 
 
 
 
 
 
 
 
15
 
16
+ # Install Python dependencies
17
+ RUN pip install --no-cache-dir -r requirements.txt
 
18
 
19
+ # Copy your application files
20
+ COPY . .
21
 
22
+ # Create necessary directories if they don't exist
23
  RUN mkdir -p data chroma_db_multilingual
24
 
25
+ # Set environment variables
26
+ ENV PYTHONPATH=/app
27
+ ENV PYTHONUNBUFFERED=1
28
 
29
+ # Expose the port that FastAPI will run on
30
+ EXPOSE 7860
 
31
 
32
+ CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
 
rag_system.py CHANGED
@@ -171,16 +171,16 @@ class AgenticRAGSystem:
171
  try:
172
  # File paths - make these configurable
173
  json_files = {
174
- "guide": "Guide-pratique-de-mise-en-oeuvre-du-calendrier-national-de-vaccination-2023.json",
175
- "section_1": "section_one_chunks.json",
176
- "section_2": "section_two_chunks.json",
177
- "section_3": "section_three_chunks.json",
178
- "section_4": "section_four_chunks.json",
179
- "section_5": "section_five_chunks.json",
180
- "section_6": "section_six_chunks.json",
181
- "section_7": "section_seven_chunks.json",
182
- "section_8": "section_eight_chunks.json",
183
- "section_9": "section_nine_chunks.json",
184
  "section_10": "section_ten_chunks.json",
185
  }
186
 
 
171
  try:
172
  # File paths - make these configurable
173
  json_files = {
174
+ # "guide": "Guide-pratique-de-mise-en-oeuvre-du-calendrier-national-de-vaccination-2023.json",
175
+ # "section_1": "section_one_chunks.json",
176
+ # "section_2": "section_two_chunks.json",
177
+ # "section_3": "section_three_chunks.json",
178
+ # "section_4": "section_four_chunks.json",
179
+ # "section_5": "section_five_chunks.json",
180
+ # "section_6": "section_six_chunks.json",
181
+ # "section_7": "section_seven_chunks.json",
182
+ # "section_8": "section_eight_chunks.json",
183
+ # "section_9": "section_nine_chunks.json",
184
  "section_10": "section_ten_chunks.json",
185
  }
186
 
requirements.txt CHANGED
@@ -1,32 +1,20 @@
1
- # Core FastAPI and server
2
- fastapi==0.115.0
3
- uvicorn[standard]==0.30.6
4
- pydantic==2.9.2
5
 
6
- # LangChain ecosystem
7
- langchain==0.3.1
8
- langchain-community==0.3.1
9
- langchain-core==0.3.6
10
- langchain-google-genai==2.0.1
11
 
12
- # LlamaIndex - using stable versions
13
- llama-index==0.10.57
14
- llama-index-llms-google==0.1.13
15
- llama-index-embeddings-huggingface==0.2.2
16
 
17
  # Vector stores and search
18
- chromadb==0.5.5
19
- rank-bm25==0.2.2
20
 
21
  # ML and embeddings
22
- sentence-transformers==3.1.1
23
- huggingface-hub==0.25.2
24
- transformers==4.45.2
25
-
26
- # Google AI
27
- google-generativeai==0.8.2
28
-
29
- # Utilities
30
- python-dotenv==1.0.1
31
- langdetect==1.0.9
32
- numpy==1.26.4
 
1
+ # FastAPI and server
2
+ fastapi==0.104.1
3
+ uvicorn[standard]==0.24.0
 
4
 
5
+ # LlamaIndex core components
6
+ llama-index-core
7
+ llama-index-embeddings-huggingface
8
+ llama-index-llms-google
 
9
 
10
+ # LangChain components
11
+ langchain
12
+ langchain-community
13
+ langchain-google-genai
14
 
15
  # Vector stores and search
16
+ chromadb
17
+ rank-bm25
18
 
19
  # ML and embeddings
20
+ sentence-transformers