john5050 commited on
Commit
256cbfa
·
1 Parent(s): e68f6e0

deployment using docker

Browse files
Files changed (3) hide show
  1. app.py +1 -1
  2. deploy.dockerfile +27 -0
  3. requirements.txt +2 -4
app.py CHANGED
@@ -172,4 +172,4 @@ def predict():
172
 
173
  if __name__ == "__main__":
174
  print(f"Running on: {device}")
175
- app.run(debug=True, port=5000)
 
172
 
173
  if __name__ == "__main__":
174
  print(f"Running on: {device}")
175
+ app.run(debug=True, port=7860)
deploy.dockerfile ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.10-slim
2
+
3
+ WORKDIR /app
4
+
5
+ # System dependencies
6
+ RUN apt-get update && apt-get install -y \
7
+ libglib2.0-0 \
8
+ libsm6 \
9
+ libxext6 \
10
+ libxrender-dev \
11
+ libgomp1 \
12
+ && rm -rf /var/lib/apt/lists/*
13
+
14
+ # Install CPU-only PyTorch first (keeps image small)
15
+ RUN pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu
16
+
17
+ # Install rest of dependencies
18
+ COPY requirements.txt .
19
+ RUN pip install -r requirements.txt
20
+
21
+ # Copy project files
22
+ COPY . .
23
+
24
+ # HuggingFace Spaces requires port 7860
25
+ EXPOSE 7860
26
+
27
+ CMD ["python", "app.py"]
requirements.txt CHANGED
@@ -1,8 +1,6 @@
1
  flask
2
- torch
3
- torchvision
4
  segmentation-models-pytorch
5
  albumentations
6
- opencv-python
7
  pillow
8
- numpy
 
1
  flask
 
 
2
  segmentation-models-pytorch
3
  albumentations
4
+ opencv-python-headless
5
  pillow
6
+ numpy