File size: 1,257 Bytes
6755895
54b04d2
 
641986e
 
54b04d2
641986e
 
 
 
 
 
 
 
 
 
54b04d2
5ee6fad
641986e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5cfd7fc
641986e
 
cdda69d
57f6126
641986e
57f6126
641986e
 
 
 
 
54b04d2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
FROM python:3.12

WORKDIR /code

# Set environment variables
ENV HF_HOME=/code/.cache/
ENV PYTHONUNBUFFERED=1

# Install system dependencies
RUN apt-get update && apt-get install -y \
    libgl1 \
    libglib2.0-0 \
    wget \
    && rm -rf /var/lib/apt/lists/*

# Copy requirements first for better layer caching
COPY ./requirements.txt /code/requirements.txt

# Install Python dependencies
RUN pip install --no-cache-dir --upgrade pip && \
    pip install --no-cache-dir -r /code/requirements.txt

# Download model files
RUN gdown 1rNuPqBymyU_C257g9gy7rBZuzZ_JLjB5 && \
    gdown 1vL2JusohMBI1IgNlS7pgiY2felggEsvXgGHlKINs3ic && \
    gdown 1kQ9N7oWpMJuJ1_QeilrWq6pbXR0b0gZh && \
    gdown 1yjUremWtmGr8G2y99jeK9iSq9a4ytHIi && \
    gdown 1sg_HXv0HoEYYczWOEV9VrutBmib-jk1Y && \
    gdown 1-5MBTIn5aCfoFzraIPKZ_RcOD4i67mY4 && \
    gdown 1UAyr6fD8UubpSqMqrU2s_1ukWLBbZVZl && \
    wget https://github.com/ultralytics/assets/releases/download/v8.3.0/yolo11m.pt

# Copy application code
COPY . .

# Create necessary directories
RUN mkdir -p /code/Chroma/ && chmod 777 /code/Chroma/

# Run as root (required for Hugging Face Spaces)
USER root

# Expose port
EXPOSE 7860

# Start the application
CMD ["uvicorn", "api:app", "--host", "0.0.0.0", "--port", "7860"]