Harsh commited on
Commit
972c66f
·
1 Parent(s): c95c2b4

Optimize Dockerfile for HF Spaces with staged dependency installation

Browse files
Files changed (3) hide show
  1. Dockerfile +49 -0
  2. README.md +1 -1
  3. requirements.txt +2 -2
Dockerfile ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.10-slim
2
+
3
+ WORKDIR /app
4
+
5
+ # Install system dependencies required for the app
6
+ RUN apt-get update && apt-get install -y --no-install-recommends \
7
+ git \
8
+ git-lfs \
9
+ ffmpeg \
10
+ libsm6 \
11
+ libxext6 \
12
+ cmake \
13
+ libgl1 \
14
+ && git lfs install \
15
+ && rm -rf /var/lib/apt/lists/*
16
+
17
+ # Upgrade pip and install build tools
18
+ RUN pip install --no-cache-dir --upgrade pip setuptools wheel
19
+
20
+ # Install Python dependencies in stages to avoid conflicts
21
+ # Stage 1: Core scientific packages
22
+ RUN pip install --no-cache-dir \
23
+ numpy>=1.24.0,<2.0 \
24
+ matplotlib>=3.7.0 \
25
+ Pillow>=10.0.0
26
+
27
+ # Stage 2: LiDAR processing packages
28
+ RUN pip install --no-cache-dir \
29
+ laspy[laszip]>=2.5.0 \
30
+ trimesh>=4.0.0
31
+
32
+ # Stage 3: Gradio and web framework (do this last to avoid dependency conflicts)
33
+ RUN pip install --no-cache-dir \
34
+ gradio \
35
+ gradio-client
36
+
37
+ # Copy application files
38
+ COPY . /app
39
+
40
+ # Expose port for HF Spaces
41
+ EXPOSE 7860
42
+
43
+ # Set environment variables for HF Spaces
44
+ ENV GRADIO_SERVER_NAME="0.0.0.0"
45
+ ENV GRADIO_SERVER_PORT=7860
46
+
47
+ # Run the application
48
+ CMD ["python", "app.py"]
49
+
README.md CHANGED
@@ -13,7 +13,7 @@ pinned: false
13
 
14
  A web application for visualizing and analyzing LiDAR point cloud data in 3D.
15
 
16
- ![Python](https://img.shields.io/badge/Python-3.9+-blue)
17
  ![Gradio](https://img.shields.io/badge/Gradio-4.43.0+-green)
18
  ![License](https://img.shields.io/badge/License-MIT-yellow)
19
 
 
13
 
14
  A web application for visualizing and analyzing LiDAR point cloud data in 3D.
15
 
16
+ ![Python](https://img.shields.io/badge/Python-3.10+-blue)
17
  ![Gradio](https://img.shields.io/badge/Gradio-4.43.0+-green)
18
  ![License](https://img.shields.io/badge/License-MIT-yellow)
19
 
requirements.txt CHANGED
@@ -1,6 +1,6 @@
1
  # Core
2
- gradio==4.43.0
3
- numpy>=1.24.0
4
 
5
  # LiDAR Processing
6
  laspy[laszip]>=2.5.0
 
1
  # Core
2
+ gradio>=4.43.0
3
+ numpy>=1.24.0,<2.0
4
 
5
  # LiDAR Processing
6
  laspy[laszip]>=2.5.0