Spaces:
Sleeping
Sleeping
Zeggai Abdellah
commited on
Commit
·
8efef2c
1
Parent(s):
d5f8cfd
fix the requirement file
Browse files- Dockerfile +17 -31
- rag_system.py +10 -10
- requirements.txt +14 -26
Dockerfile
CHANGED
|
@@ -1,46 +1,32 @@
|
|
| 1 |
-
# Use Python 3.
|
| 2 |
-
FROM python:3.
|
| 3 |
|
| 4 |
-
# Set
|
| 5 |
-
|
| 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 |
-
#
|
| 17 |
-
|
| 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
|
| 29 |
-
RUN pip install --no-cache-dir
|
| 30 |
-
pip install --no-cache-dir --timeout 300 -r requirements.txt
|
| 31 |
|
| 32 |
-
# Copy
|
| 33 |
-
COPY
|
| 34 |
|
| 35 |
-
# Create necessary directories
|
| 36 |
RUN mkdir -p data chroma_db_multilingual
|
| 37 |
|
| 38 |
-
#
|
| 39 |
-
|
|
|
|
| 40 |
|
| 41 |
-
#
|
| 42 |
-
|
| 43 |
-
CMD curl -f http://localhost:7860/health || exit 1
|
| 44 |
|
| 45 |
-
|
| 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 |
-
#
|
| 2 |
-
fastapi==0.
|
| 3 |
-
uvicorn[standard]==0.
|
| 4 |
-
pydantic==2.9.2
|
| 5 |
|
| 6 |
-
#
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
langchain-google-genai==2.0.1
|
| 11 |
|
| 12 |
-
#
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
|
| 17 |
# Vector stores and search
|
| 18 |
-
chromadb
|
| 19 |
-
rank-bm25
|
| 20 |
|
| 21 |
# ML and embeddings
|
| 22 |
-
sentence-transformers
|
| 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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|