Spaces:
Sleeping
Sleeping
File size: 940 Bytes
51e944e | 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 | # Use official Python slim image
FROM python:3.10-slim
# Set working directory
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
curl \
&& rm -rf /var/lib/apt/lists/*
# Copy Python dependencies
COPY requirements.txt .
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Create models directory and download models from HF
RUN mkdir -p /app/models && \
curl -fSL -o /app/models/efficientnet.keras https://huggingface.co/b3rian/resnet/resolve/main/efficientnet.keras && \
curl -fSL -o /app/models/resnet50_imagenet.keras https://huggingface.co/b3rian/resnet/resolve/main/resnet50_imagenet.keras
# Copy API code into the container
COPY api_backend/ ./api_backend/
# Expose the port the app runs on
EXPOSE 7860
# Set environment variables
ENV MODEL_DIR=/app/models
# Run the API
CMD ["uvicorn", "api_backend.backup:app", "--host", "0.0.0.0", "--port", "7860"]
|