Spaces:
Running
Running
Upload Dockerfile and requirements
Browse files- Dockerfile +45 -0
- requirements.txt +35 -0
Dockerfile
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# User Modeling Agent β DSN Γ BCT LLM Agent Challenge, Task A
|
| 2 |
+
# Containerized Streamlit web application.
|
| 3 |
+
#
|
| 4 |
+
# Build: docker build -t user-modeling-agent .
|
| 5 |
+
# Run: docker run -p 7860:7860 --env-file .env user-modeling-agent
|
| 6 |
+
# Open: http://localhost:7860
|
| 7 |
+
#
|
| 8 |
+
# The container needs an LLM key at runtime. Pass it with --env-file .env
|
| 9 |
+
# (a file containing LLM_PROVIDER and GEMINI_API_KEY / OPENAI_API_KEY),
|
| 10 |
+
# or with -e LLM_PROVIDER=gemini -e GEMINI_API_KEY=...
|
| 11 |
+
|
| 12 |
+
FROM python:3.11-slim
|
| 13 |
+
|
| 14 |
+
# System deps occasionally needed by pandas / pyarrow wheels
|
| 15 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 16 |
+
build-essential \
|
| 17 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 18 |
+
|
| 19 |
+
WORKDIR /app
|
| 20 |
+
|
| 21 |
+
# Install Python dependencies first so this layer caches across code changes
|
| 22 |
+
COPY requirements.txt .
|
| 23 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 24 |
+
|
| 25 |
+
# Copy the application
|
| 26 |
+
COPY . .
|
| 27 |
+
|
| 28 |
+
# Streamlit serves on 7860
|
| 29 |
+
EXPOSE 7860
|
| 30 |
+
|
| 31 |
+
# Container healthcheck β Streamlit exposes a health endpoint
|
| 32 |
+
HEALTHCHECK --interval=30s --timeout=5s --start-period=20s --retries=3 \
|
| 33 |
+
CMD python -c "import urllib.request,sys; urllib.request.urlopen('http://localhost:7860/_stcore/health'); " || exit 1
|
| 34 |
+
|
| 35 |
+
# Run the Streamlit web app, reachable from outside the container
|
| 36 |
+
ENTRYPOINT ["streamlit", "run", "app.py", \
|
| 37 |
+
"--server.port=7860", \
|
| 38 |
+
"--server.address=0.0.0.0", \
|
| 39 |
+
"--server.headless=true"]
|
| 40 |
+
|
| 41 |
+
# --- Alternative: run the FastAPI service instead of the Streamlit app ---
|
| 42 |
+
# Comment out the ENTRYPOINT above and uncomment below:
|
| 43 |
+
# EXPOSE 8000
|
| 44 |
+
# ENTRYPOINT ["uvicorn", "task_a_user_modeling.main:app", \
|
| 45 |
+
# "--host", "0.0.0.0", "--port", "8000"]
|
requirements.txt
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# ββ Core βββββββββββββββββββββββββββββββββββββββββββββ
|
| 2 |
+
openai>=1.50.0
|
| 3 |
+
langchain>=0.3.0
|
| 4 |
+
langchain-openai>=0.2.0
|
| 5 |
+
langchain-google-genai>=2.0.0 # Gemini support (optional, only if LLM_PROVIDER=gemini)
|
| 6 |
+
langchain-core>=0.3.0
|
| 7 |
+
python-dotenv>=1.0.0
|
| 8 |
+
tenacity>=8.2.0 # retry decorator for flaky LLM calls
|
| 9 |
+
|
| 10 |
+
# ββ Data βββββββββββββββββββββββββββββββββββββββββββββ
|
| 11 |
+
pandas>=2.2.0
|
| 12 |
+
numpy>=1.26.0
|
| 13 |
+
pyarrow>=15.0.0 # parquet for Amazon Reviews 2023
|
| 14 |
+
datasets>=2.18.0 # huggingface datasets loader
|
| 15 |
+
|
| 16 |
+
# ββ Embeddings & retrieval βββββββββββββββββββββββββββ
|
| 17 |
+
chromadb>=0.5.0
|
| 18 |
+
sentence-transformers>=3.0.0
|
| 19 |
+
|
| 20 |
+
# ββ API + UI βββββββββββββββββββββββββββββββββββββββββ
|
| 21 |
+
fastapi>=0.110.0
|
| 22 |
+
uvicorn[standard]>=0.29.0
|
| 23 |
+
pydantic>=2.6.0
|
| 24 |
+
streamlit>=1.32.0
|
| 25 |
+
httpx>=0.27.0
|
| 26 |
+
|
| 27 |
+
# ββ Evaluation βββββββββββββββββββββββββββββββββββββββ
|
| 28 |
+
bert-score>=0.3.13
|
| 29 |
+
scikit-learn>=1.4.0
|
| 30 |
+
tqdm>=4.66.0
|
| 31 |
+
|
| 32 |
+
# ββ Dev / paper ββββββββββββββββββββββββββββββββββββββ
|
| 33 |
+
jupyter>=1.0.0
|
| 34 |
+
matplotlib>=3.8.0
|
| 35 |
+
seaborn>=0.13.0
|