omoi-ui-detector / Dockerfile
makeitfr's picture
Upload Dockerfile with huggingface_hub
b174cf9 verified
Raw
History Blame Contribute Delete
1.19 kB
# Hugging Face Spaces optimized Dockerfile for OmniParser UI Detector
FROM python:3.10-slim
# Set environment variables
ENV PYTHONUNBUFFERED=1 \
OMP_NUM_THREADS=4 \
TRANSFORMERS_CACHE=/app/models \
PADDLEOCR_HOME=/app/paddle_models
# Install system dependencies
RUN apt-get update && apt-get install -y \
build-essential \
git \
libopenblas-dev \
liblapack-dev \
libgomp1 \
libsm6 \
libxext6 \
libxrender-dev \
&& rm -rf /var/lib/apt/lists/*
# Set working directory
WORKDIR /app
# Copy requirements
COPY requirements_hf_spaces.txt requirements.txt .
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements_hf_spaces.txt
# Copy application code
COPY . .
# Create directories for models, cache, and outputs
RUN mkdir -p /app/models /app/paddle_models /tmp/omoi_cropped_images /app/output /app/data
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=120s --retries=3 \
CMD python -c "import requests; requests.get('http://localhost:7860/api/health')" || exit 1
# Run the FastAPI server (port 7860 for HF Spaces)
CMD ["python", "app_hf_spaces_server.py", "--port", "7860", "--host", "0.0.0.0"]