Spaces:
Sleeping
Sleeping
| # Base image with Python | |
| FROM python:3.10-slim | |
| # Set working directory | |
| WORKDIR /app | |
| # Environment variables | |
| ENV PYTHONUNBUFFERED=1 | |
| ENV MODEL_DIR=/tmp/models/realvisxl_v4 | |
| # Install system dependencies | |
| RUN apt-get update && apt-get install -y \ | |
| git \ | |
| wget \ | |
| curl \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Copy all project files | |
| COPY . /app | |
| # β Create and open permissions for /tmp and cache dirs | |
| RUN mkdir -p /tmp/hf_cache /tmp/models/realvisxl_v4 && chmod -R 777 /tmp /root /app | |
| # --- Install Python dependencies --- | |
| RUN pip install --no-cache-dir \ | |
| annotated-types==0.7.0 \ | |
| anyio==4.11.0 \ | |
| certifi==2025.10.5 \ | |
| click==8.3.0 \ | |
| colorama==0.4.6 \ | |
| fastapi==0.119.0 \ | |
| h11==0.16.0 \ | |
| httpcore==1.0.9 \ | |
| httpx==0.28.1 \ | |
| idna==3.11 \ | |
| pydantic==2.12.2 \ | |
| pydantic_core==2.41.4 \ | |
| python-dotenv==1.1.1 \ | |
| sniffio==1.3.1 \ | |
| starlette==0.48.0 \ | |
| typing_extensions==4.15.0 \ | |
| typing-inspection==0.4.2 \ | |
| uvicorn==0.37.0 \ | |
| torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cpu \ | |
| diffusers==0.30.3 \ | |
| huggingface_hub==0.26.2 \ | |
| accelerate==1.1.1 \ | |
| safetensors==0.4.5 \ | |
| pillow==10.4.0\ | |
| transformers==4.44.2 | |
| # Expose the API port | |
| EXPOSE 7860 | |
| # Start FastAPI (main.py is inside app/) | |
| CMD ["uvicorn", "api.server:app", "--host", "0.0.0.0", "--port", "7860"] | |