Spaces:
Runtime error
Runtime error
maralzar Cursor commited on
Commit ·
27c67d2
1
Parent(s): 5212b8e
Switch HF Space SDK from streamlit to docker
Browse filesHF removed Streamlit as a top-level Space SDK; the supported path is now
Docker SDK with a user-provided Dockerfile.
- Dockerfile: python:3.10-slim, runs as user 1000 (HF Spaces convention),
installs requirements.txt, pre-warms BAAI/bge-small-en-v1.5 at build
time so first request is fast, exposes port 7860, launches Streamlit
bound to 0.0.0.0 with CORS/XSRF relaxed for HF's reverse proxy.
- README.md frontmatter: sdk -> docker, app_port -> 7860, drop the
streamlit-specific keys.
Co-authored-by: Cursor <cursoragent@cursor.com>
- Dockerfile +38 -0
- README.md +2 -4
Dockerfile
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM python:3.10-slim
|
| 2 |
+
|
| 3 |
+
ENV PYTHONDONTWRITEBYTECODE=1 \
|
| 4 |
+
PYTHONUNBUFFERED=1 \
|
| 5 |
+
PIP_NO_CACHE_DIR=1 \
|
| 6 |
+
HF_HOME=/home/user/.cache/huggingface \
|
| 7 |
+
SENTENCE_TRANSFORMERS_HOME=/home/user/.cache/huggingface \
|
| 8 |
+
STREAMLIT_SERVER_HEADLESS=true \
|
| 9 |
+
STREAMLIT_BROWSER_GATHERUSAGESTATS=false
|
| 10 |
+
|
| 11 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 12 |
+
build-essential \
|
| 13 |
+
git \
|
| 14 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 15 |
+
|
| 16 |
+
# HF Spaces convention: run as non-root user 1000
|
| 17 |
+
RUN useradd -m -u 1000 user
|
| 18 |
+
USER user
|
| 19 |
+
ENV PATH="/home/user/.local/bin:${PATH}"
|
| 20 |
+
WORKDIR /home/user/app
|
| 21 |
+
|
| 22 |
+
COPY --chown=user requirements.txt ./
|
| 23 |
+
RUN pip install --user --upgrade pip && \
|
| 24 |
+
pip install --user --no-cache-dir -r requirements.txt
|
| 25 |
+
|
| 26 |
+
COPY --chown=user . ./
|
| 27 |
+
|
| 28 |
+
# Pre-warm the embedding model at build time so first request is fast and
|
| 29 |
+
# doesn't hit a cold HF download from inside the running container.
|
| 30 |
+
RUN python -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('BAAI/bge-small-en-v1.5')"
|
| 31 |
+
|
| 32 |
+
EXPOSE 7860
|
| 33 |
+
|
| 34 |
+
CMD ["streamlit", "run", "app.py", \
|
| 35 |
+
"--server.port=7860", \
|
| 36 |
+
"--server.address=0.0.0.0", \
|
| 37 |
+
"--server.enableCORS=false", \
|
| 38 |
+
"--server.enableXsrfProtection=false"]
|
README.md
CHANGED
|
@@ -3,10 +3,8 @@ title: EPCC Contract Intelligence
|
|
| 3 |
emoji: 📑
|
| 4 |
colorFrom: blue
|
| 5 |
colorTo: indigo
|
| 6 |
-
sdk:
|
| 7 |
-
|
| 8 |
-
app_file: app.py
|
| 9 |
-
python_version: "3.10"
|
| 10 |
pinned: false
|
| 11 |
license: mit
|
| 12 |
short_description: Local clause/risk classifier for EPCC contract triage
|
|
|
|
| 3 |
emoji: 📑
|
| 4 |
colorFrom: blue
|
| 5 |
colorTo: indigo
|
| 6 |
+
sdk: docker
|
| 7 |
+
app_port: 7860
|
|
|
|
|
|
|
| 8 |
pinned: false
|
| 9 |
license: mit
|
| 10 |
short_description: Local clause/risk classifier for EPCC contract triage
|