Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files
Dockerfile
CHANGED
|
@@ -22,7 +22,6 @@ RUN pip install --no-cache-dir -r requirements-space.txt
|
|
| 22 |
COPY app/pyproject.toml ./
|
| 23 |
COPY app/src/ ./src/
|
| 24 |
COPY app/frontend/ ./frontend/
|
| 25 |
-
COPY app/deploy/seed_data/ ./seed_data/ # prebuilt all-books DB + FAISS index (~40 MB)
|
| 26 |
RUN pip install --no-cache-dir -e . --no-deps && \
|
| 27 |
mkdir -p /data && chown -R user:user /app /data
|
| 28 |
|
|
@@ -43,7 +42,9 @@ ENV INKFERENCE_DATA_ROOT=/data \
|
|
| 43 |
LLM_PROVIDER=groq \
|
| 44 |
LLM_MODEL=openai/gpt-oss-120b \
|
| 45 |
LLM_FALLBACK=gemini:gemini-2.5-flash-lite \
|
| 46 |
-
RAG_USE_CORRECTED=true
|
|
|
|
|
|
|
| 47 |
# REQUIRED Space secrets: GROQ_API_KEY, GEMINI_API_KEY
|
| 48 |
# REQUIRED Space variable (page scans): INKFERENCE_IMAGES_BASE_URL=
|
| 49 |
# https://huggingface.co/datasets/<user>/inkference-book-images/resolve/main
|
|
@@ -55,7 +56,14 @@ USER user
|
|
| 55 |
RUN python -c "from sentence_transformers import SentenceTransformer as S; S('sentence-transformers/all-MiniLM-L6-v2')"
|
| 56 |
RUN python -c "from transformers import TrOCRProcessor, VisionEncoderDecoderModel as M; TrOCRProcessor.from_pretrained('microsoft/trocr-base-handwritten'); M.from_pretrained('microsoft/trocr-base-handwritten')"
|
| 57 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
EXPOSE 7860
|
| 59 |
|
| 60 |
# Copy the prebuilt corpus into the (ephemeral) data root on boot, then serve. No re-seed.
|
| 61 |
-
CMD ["sh", "-c", "cp -rn /app/seed_data/. /data/ 2>/dev/null || true; uvicorn inkference.api.main:app --host 0.0.0.0 --port ${PORT:-7860}"]
|
|
|
|
| 22 |
COPY app/pyproject.toml ./
|
| 23 |
COPY app/src/ ./src/
|
| 24 |
COPY app/frontend/ ./frontend/
|
|
|
|
| 25 |
RUN pip install --no-cache-dir -e . --no-deps && \
|
| 26 |
mkdir -p /data && chown -R user:user /app /data
|
| 27 |
|
|
|
|
| 42 |
LLM_PROVIDER=groq \
|
| 43 |
LLM_MODEL=openai/gpt-oss-120b \
|
| 44 |
LLM_FALLBACK=gemini:gemini-2.5-flash-lite \
|
| 45 |
+
RAG_USE_CORRECTED=true \
|
| 46 |
+
# dataset holding the prebuilt corpus (seed_data/) AND the scans (book*/forster*/)
|
| 47 |
+
SEED_DATASET=sajitkun125/inkference-book-images
|
| 48 |
# REQUIRED Space secrets: GROQ_API_KEY, GEMINI_API_KEY
|
| 49 |
# REQUIRED Space variable (page scans): INKFERENCE_IMAGES_BASE_URL=
|
| 50 |
# https://huggingface.co/datasets/<user>/inkference-book-images/resolve/main
|
|
|
|
| 56 |
RUN python -c "from sentence_transformers import SentenceTransformer as S; S('sentence-transformers/all-MiniLM-L6-v2')"
|
| 57 |
RUN python -c "from transformers import TrOCRProcessor, VisionEncoderDecoderModel as M; TrOCRProcessor.from_pretrained('microsoft/trocr-base-handwritten'); M.from_pretrained('microsoft/trocr-base-handwritten')"
|
| 58 |
|
| 59 |
+
# Fetch the prebuilt DB + FAISS index from the dataset. snapshot_download RESOLVES LFS
|
| 60 |
+
# to real bytes (unlike the Space's Docker build, which ships LFS as pointers). Only the
|
| 61 |
+
# seed_data/ folder is pulled — the 1.3 GB scans stay remote and stream via the CDN.
|
| 62 |
+
RUN python -c "import os; from huggingface_hub import snapshot_download; \
|
| 63 |
+
snapshot_download(os.environ['SEED_DATASET'], repo_type='dataset', \
|
| 64 |
+
allow_patterns=['seed_data/*'], local_dir='/app/hub')"
|
| 65 |
+
|
| 66 |
EXPOSE 7860
|
| 67 |
|
| 68 |
# Copy the prebuilt corpus into the (ephemeral) data root on boot, then serve. No re-seed.
|
| 69 |
+
CMD ["sh", "-c", "cp -rn /app/hub/seed_data/. /data/ 2>/dev/null || true; uvicorn inkference.api.main:app --host 0.0.0.0 --port ${PORT:-7860}"]
|
app/deploy/seed_data/index/doc_1.faiss
DELETED
|
@@ -1,3 +0,0 @@
|
|
| 1 |
-
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:dff3e63c3a13fb3d5cc9f23c2239d4bb270aa496bc0658179b6a2356fb6ffa91
|
| 3 |
-
size 4108845
|
|
|
|
|
|
|
|
|
|
|
|
app/deploy/seed_data/index/doc_1.json
DELETED
|
The diff for this file is too large to render.
See raw diff
|
|
|
app/deploy/seed_data/inkference.db
DELETED
|
@@ -1,3 +0,0 @@
|
|
| 1 |
-
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:10c7568dfd0d88563bd5f19d71a6330f47fcfe61a229f132c91364386252f67b
|
| 3 |
-
size 34762752
|
|
|
|
|
|
|
|
|
|
|
|