File size: 1,178 Bytes
b461192
4f89b12
 
 
 
 
b461192
4f89b12
b461192
 
 
4f89b12
 
b461192
4f89b12
 
 
 
bc450e0
4f89b12
 
 
 
b461192
 
4f89b12
b461192
bc450e0
 
 
 
b461192
 
 
4f89b12
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
# Optional: use Hugging Face Space SDK = docker (set `sdk: docker` in README.md).
#
# IMPORTANT:
# - If your Space is on CPU hardware, `torch.cuda.is_available()` will be False no matter what.
# - If your Space is on GPU hardware, you must use a CUDA-enabled base image (below),
#   otherwise CUDA won't be visible inside the container.

FROM nvidia/cuda:12.1.1-cudnn8-runtime-ubuntu22.04

WORKDIR /app

ENV DEBIAN_FRONTEND=noninteractive \
    PYTHONUNBUFFERED=1 \
    PIP_NO_CACHE_DIR=1 \
    GRADIO_SERVER_NAME=0.0.0.0 \
    NVIDIA_VISIBLE_DEVICES=all \
    NVIDIA_DRIVER_CAPABILITIES=compute,utility

# Python + basic deps
RUN apt-get update && apt-get install -y --no-install-recommends \
    python3.11 python3.11-venv python3-pip \
    git ca-certificates \
  && rm -rf /var/lib/apt/lists/*

COPY requirements.txt .
RUN python3.11 -m pip install --upgrade pip && python3.11 -m pip install -r requirements.txt

# CUDA-enabled PyTorch (so `torch.cuda.is_available()` is True on GPU Spaces)
RUN python3.11 -m pip install --no-cache-dir \
    torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121

COPY . .

EXPOSE 7860
CMD ["python3.11", "app.py"]