tejani commited on
Commit
5c0f98c
·
verified ·
1 Parent(s): c7b93b3

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +37 -0
app.py ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.10-slim
2
+
3
+ # Set working directory
4
+ WORKDIR /app
5
+
6
+ # Install system dependencies
7
+ RUN apt-get update && apt-get install -y \
8
+ git \
9
+ git-lfs \
10
+ gcc \
11
+ python3-dev \
12
+ && rm -rf /var/lib/apt/lists/*
13
+
14
+ # Initialize git-lfs
15
+ RUN git lfs install
16
+
17
+ # Clone the fastsdcpu repository
18
+ RUN git clone https://github.com/rupeshs/fastsdcpu.git .
19
+
20
+ # Install Python dependencies
21
+ RUN python -m venv env && \
22
+ . env/bin/activate && \
23
+ pip install --upgrade pip && \
24
+ pip install torch==2.2.2 --index-url https://download.pytorch.org/whl/cpu && \
25
+ pip install -r requirements.txt
26
+
27
+ # Download a default model (e.g., lcm-lora-sdv1-5)
28
+ RUN git clone https://huggingface.co/latent-consistency/lcm-lora-sdv1-5 /models/lcm-lora-sdv1-5
29
+
30
+ # Configure the model path
31
+ RUN echo "/models/lcm-lora-sdv1-5" > configs/lcm-lora-models.txt
32
+
33
+ # Expose the API port (default is 8000 based on typical web server setups)
34
+ EXPOSE 8000
35
+
36
+ # Activate virtual environment and run the API server
37
+ CMD ["/bin/bash", "-c", ". env/bin/activate && python src/app.py --api"]