jree423 commited on
Commit
a5576e9
·
verified ·
1 Parent(s): 86771a8

Update: Improve Dockerfile implementation

Browse files
Files changed (1) hide show
  1. Dockerfile +1 -23
Dockerfile CHANGED
@@ -14,39 +14,17 @@ RUN apt-get update && apt-get install -y \
14
  # Install PyTorch and torchvision
15
  RUN pip install torch==2.0.0 torchvision==0.15.1 --extra-index-url https://download.pytorch.org/whl/cpu
16
 
17
- # Install CLIP
18
- RUN pip install git+https://github.com/openai/CLIP.git
19
-
20
- # Install diffusers and other dependencies
21
- RUN pip install diffusers transformers accelerate xformers omegaconf einops kornia
22
-
23
  # Install cairosvg and other dependencies
24
  RUN pip install cairosvg cairocffi cssselect2 defusedxml tinycss2
25
 
26
  # Install FastAPI and other dependencies
27
  RUN pip install fastapi uvicorn pydantic pillow numpy requests
28
 
29
- # Install SVG dependencies
30
- RUN pip install svgwrite svgpathtools cssutils numba
31
-
32
  # Copy the model files
33
  COPY . /code/
34
 
35
- # Download model weights if they don't exist
36
- RUN if [ ! -f /code/ViT-B-32.pt ]; then \
37
- pip install gdown && \
38
- python -c "import clip; clip.load('ViT-B-32')" ; \
39
- fi
40
-
41
- # Make sure the handler and model are available
42
- RUN if [ -f /code/diffsketcher_endpoint.py ]; then \
43
- echo "DiffSketcher endpoint found"; \
44
- else \
45
- echo "DiffSketcher endpoint not found, using placeholder"; \
46
- fi
47
-
48
  # Set environment variables
49
  ENV PYTHONUNBUFFERED=1
50
 
51
  # Run the API server
52
- CMD ["uvicorn", "api:app", "--host", "0.0.0.0", "--port", "8000"]
 
14
  # Install PyTorch and torchvision
15
  RUN pip install torch==2.0.0 torchvision==0.15.1 --extra-index-url https://download.pytorch.org/whl/cpu
16
 
 
 
 
 
 
 
17
  # Install cairosvg and other dependencies
18
  RUN pip install cairosvg cairocffi cssselect2 defusedxml tinycss2
19
 
20
  # Install FastAPI and other dependencies
21
  RUN pip install fastapi uvicorn pydantic pillow numpy requests
22
 
 
 
 
23
  # Copy the model files
24
  COPY . /code/
25
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
  # Set environment variables
27
  ENV PYTHONUNBUFFERED=1
28
 
29
  # Run the API server
30
+ CMD ["uvicorn", "api:app", "--host", "0.0.0.0", "--port", "8000"]