Spaces:
Sleeping
Sleeping
dockerfile updates
Browse files- Dockerfile +10 -15
- README.md +2 -2
Dockerfile
CHANGED
|
@@ -2,41 +2,36 @@ FROM python:3.11-slim
|
|
| 2 |
|
| 3 |
WORKDIR /app
|
| 4 |
|
| 5 |
-
# Set Hugging Face cache directory to a build-in writeable directory
|
| 6 |
ENV HF_HOME=/app/.cache/huggingface
|
| 7 |
-
# Tell NLTK where to find downloaded data
|
| 8 |
ENV NLTK_DATA=/app/nltk_data
|
| 9 |
|
| 10 |
-
# Install system deps for numpy/umap
|
| 11 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 12 |
-
build-essential gcc && \
|
| 13 |
rm -rf /var/lib/apt/lists/*
|
| 14 |
|
| 15 |
-
# Copy and install Python deps
|
| 16 |
COPY pyproject.toml .
|
| 17 |
RUN pip install --no-cache-dir .
|
| 18 |
|
| 19 |
-
# Pre-download NLTK data
|
| 20 |
RUN mkdir -p /app/nltk_data && \
|
| 21 |
python -c "import nltk; nltk.download('punkt', download_dir='/app/nltk_data'); nltk.download('punkt_tab', download_dir='/app/nltk_data'); nltk.download('stopwords', download_dir='/app/nltk_data')"
|
| 22 |
|
| 23 |
-
# Pre-download public HF embedding models
|
| 24 |
-
# Note: we exclude the gated google/gemma-3n-embedding-exp to prevent build failures.
|
| 25 |
RUN python -c "from huggingface_hub import snapshot_download; \
|
| 26 |
snapshot_download(repo_id='nomic-ai/nomic-embed-text-v1.5'); \
|
| 27 |
snapshot_download(repo_id='Qwen/Qwen3-Embedding-0.6B')"
|
| 28 |
|
| 29 |
-
#
|
| 30 |
-
RUN
|
| 31 |
-
|
|
|
|
| 32 |
|
| 33 |
-
# Copy app code
|
| 34 |
COPY . .
|
| 35 |
|
| 36 |
-
# Grant full read/write/execute permissions on /app for non-root containers in Hugging Face
|
| 37 |
RUN chmod -R 777 /app
|
| 38 |
|
| 39 |
-
# HF Spaces expects port 7860
|
| 40 |
EXPOSE 7860
|
| 41 |
|
| 42 |
-
|
|
|
|
|
|
| 2 |
|
| 3 |
WORKDIR /app
|
| 4 |
|
|
|
|
| 5 |
ENV HF_HOME=/app/.cache/huggingface
|
|
|
|
| 6 |
ENV NLTK_DATA=/app/nltk_data
|
| 7 |
|
| 8 |
+
# Install system deps for numpy/umap/llama-cpp
|
| 9 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 10 |
+
build-essential gcc g++ && \
|
| 11 |
rm -rf /var/lib/apt/lists/*
|
| 12 |
|
|
|
|
| 13 |
COPY pyproject.toml .
|
| 14 |
RUN pip install --no-cache-dir .
|
| 15 |
|
| 16 |
+
# Pre-download NLTK data
|
| 17 |
RUN mkdir -p /app/nltk_data && \
|
| 18 |
python -c "import nltk; nltk.download('punkt', download_dir='/app/nltk_data'); nltk.download('punkt_tab', download_dir='/app/nltk_data'); nltk.download('stopwords', download_dir='/app/nltk_data')"
|
| 19 |
|
| 20 |
+
# Pre-download public HF embedding models
|
|
|
|
| 21 |
RUN python -c "from huggingface_hub import snapshot_download; \
|
| 22 |
snapshot_download(repo_id='nomic-ai/nomic-embed-text-v1.5'); \
|
| 23 |
snapshot_download(repo_id='Qwen/Qwen3-Embedding-0.6B')"
|
| 24 |
|
| 25 |
+
# Download lightweight GGUF model instead of raw safetensors
|
| 26 |
+
RUN mkdir -p /app/models && \
|
| 27 |
+
python -c "from huggingface_hub import hf_hub_download; \
|
| 28 |
+
hf_hub_download(repo_id='Qwen/Qwen2.5-1.5B-Instruct-GGUF', filename='qwen2.5-1.5b-instruct-q4_k_m.gguf', local_dir='/app/models')"
|
| 29 |
|
|
|
|
| 30 |
COPY . .
|
| 31 |
|
|
|
|
| 32 |
RUN chmod -R 777 /app
|
| 33 |
|
|
|
|
| 34 |
EXPOSE 7860
|
| 35 |
|
| 36 |
+
# Force unbuffered Python output so you can actually see error logs in HF Spaces
|
| 37 |
+
CMD ["python", "-u", "-m", "uvicorn", "backend.main:app", "--host", "0.0.0.0", "--port", "7860"]
|
README.md
CHANGED
|
@@ -6,11 +6,11 @@ colorTo: red
|
|
| 6 |
sdk: docker
|
| 7 |
app_port: 7860
|
| 8 |
pinned: false
|
|
|
|
| 9 |
---
|
| 10 |
|
| 11 |
# π¬ RAG Visualizer
|
| 12 |
|
| 13 |
-
|
| 14 |
**An X-Ray machine for Retrieval-Augmented Generation pipelines.**
|
| 15 |
|
| 16 |
RAG Visualizer is an interactive, local-first tool that lets you **see** what happens inside a RAG pipeline β from how your text gets chunked, to how those chunks land in vector space, to which chunks get retrieved for a given query. No cloud APIs, no black boxes. Everything runs on your machine with local Ollama models.
|
|
@@ -51,7 +51,7 @@ Visualize and compare **5 chunking strategies** side-by-side:
|
|
| 51 |
- **Sonar Query Simulator** β Type a natural language query and watch the sonar ping animate across the canvas in real time.
|
| 52 |
- **Sonar Probe** β Click anywhere on the 2D canvas to retrieve the nearest chunks in that region.
|
| 53 |
- **Document X-Ray Highlighting** β Retrieved chunks glow dynamically in the document viewer with rank-based styling (gold for Rank 1, dashed for Rank 2, dotted for Rank 3).
|
| 54 |
-
- **Metadata Level Filtering** β Filter your context pool on the fly (retrieve
|
| 55 |
- **Cross-Encoder Reranking** β Run a local FlashRank (`ms-marco-MiniLM-L-12-v2`) engine to rerank search results.
|
| 56 |
- **Rank Shift Badges** β Visual indicators showing exactly how much chunks moved after reranking (`β² +3`, `βΌ -1`, or `β’ Unchanged`).
|
| 57 |
- **Normalized Match Strength** β Converts raw vector distances into intuitive similarity percentages (e.g. `Match: 87.7%`).
|
|
|
|
| 6 |
sdk: docker
|
| 7 |
app_port: 7860
|
| 8 |
pinned: false
|
| 9 |
+
startup_duration_timeout: 1h
|
| 10 |
---
|
| 11 |
|
| 12 |
# π¬ RAG Visualizer
|
| 13 |
|
|
|
|
| 14 |
**An X-Ray machine for Retrieval-Augmented Generation pipelines.**
|
| 15 |
|
| 16 |
RAG Visualizer is an interactive, local-first tool that lets you **see** what happens inside a RAG pipeline β from how your text gets chunked, to how those chunks land in vector space, to which chunks get retrieved for a given query. No cloud APIs, no black boxes. Everything runs on your machine with local Ollama models.
|
|
|
|
| 51 |
- **Sonar Query Simulator** β Type a natural language query and watch the sonar ping animate across the canvas in real time.
|
| 52 |
- **Sonar Probe** β Click anywhere on the 2D canvas to retrieve the nearest chunks in that region.
|
| 53 |
- **Document X-Ray Highlighting** β Retrieved chunks glow dynamically in the document viewer with rank-based styling (gold for Rank 1, dashed for Rank 2, dotted for Rank 3).
|
| 54 |
+
- **Metadata Level Filtering** β Filter your context pool on the fly (retrieve _Only Parents_, _Only Children_, or _All Levels_).
|
| 55 |
- **Cross-Encoder Reranking** β Run a local FlashRank (`ms-marco-MiniLM-L-12-v2`) engine to rerank search results.
|
| 56 |
- **Rank Shift Badges** β Visual indicators showing exactly how much chunks moved after reranking (`β² +3`, `βΌ -1`, or `β’ Unchanged`).
|
| 57 |
- **Normalized Match Strength** β Converts raw vector distances into intuitive similarity percentages (e.g. `Match: 87.7%`).
|