Spaces:
Sleeping
Sleeping
Download Dockerfile from VishalBhagat01/Fraud-API: direct link, hf CLI and curl.
- Browser
- Download file 1.15 kB
-
https://huggingface.co/spaces/VishalBhagat01/Fraud-API/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/VishalBhagat01/Fraud-API/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/VishalBhagat01/Fraud-API/resolve/main/Dockerfile
1.15 kB
| # HuggingFace Spaces runs containers as non-root user (uid=1000) | |
| FROM python:3.11-slim | |
| # Required by HuggingFace Spaces | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:$PATH | |
| WORKDIR $HOME/app | |
| # Install CPU-only torch first (saves ~1.5GB vs CUDA build) | |
| RUN pip install --no-cache-dir torch --index-url https://download.pytorch.org/whl/cpu | |
| # Copy and install dependencies | |
| COPY --chown=user requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy source code | |
| COPY --chown=user fraud_model.py . | |
| COPY --chown=user main.py . | |
| # Pre-download model at build time for fast startup | |
| # HF_HOME points to a writable location for the non-root user | |
| ENV HF_HOME=/home/user/.cache/huggingface | |
| RUN python -c "from transformers import AutoTokenizer, AutoModelForSequenceClassification; \ | |
| AutoTokenizer.from_pretrained('austinb/fraud_text_detection'); \ | |
| AutoModelForSequenceClassification.from_pretrained('austinb/fraud_text_detection')" | |
| # HuggingFace Spaces exposes port 7860 | |
| EXPOSE 7860 | |
| CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"] |