Spaces:
Running
Running
| FROM python:3.11-slim | |
| # Crea y asigna un usuario para HF Spaces (recomendado) | |
| RUN useradd -m -u 1000 user | |
| ENV PATH="/home/user/.local/bin:$PATH" | |
| ENV PYTHONUNBUFFERED=1 | |
| ENV PORT=7860 | |
| ENV ANONYMIZED_TELEMETRY=False | |
| ENV LOCAL_MODEL_CONTEXT_SIZE=2048 | |
| ENV LOCAL_MODEL_MAX_NEW_TOKENS=256 | |
| ENV LOCAL_MODEL_THREADS=2 | |
| ENV LOCAL_MODEL_BATCH_THREADS=2 | |
| ENV LOCAL_MODEL_BATCH_SIZE=256 | |
| WORKDIR /home/user/app | |
| RUN chown -R user:user /home/user/app | |
| USER user | |
| COPY --chown=user ./requirements.txt requirements.txt | |
| RUN pip install --no-cache-dir --upgrade -r requirements.txt | |
| COPY --chown=user . /home/user/app | |
| RUN python download_model.py \ | |
| --download-only \ | |
| --repo AlbertiTechnology/qwen3-4b-instruct-gguf \ | |
| --local-dir MODELS/qwen3-4b-instruct-gguf | |
| RUN python index_documents_to_chroma.py \ | |
| --documents-dir documentos/ASTM \ | |
| --persist-dir chroma_db_docs \ | |
| --collection document_context \ | |
| --reset-collection | |
| # Valida la base Chroma generada durante el build y luego inicia la API. | |
| CMD ["python", "-u", "start_hf.py"] | |