igriv commited on
Commit
f00b2e2
·
1 Parent(s): e1cd12d

Switch to Docker SDK for full control over dependencies

Browse files
Files changed (4) hide show
  1. Dockerfile +29 -0
  2. README.md +1 -3
  3. app.py +3 -3
  4. requirements.txt +1 -1
Dockerfile ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Dockerfile for HuggingFace Spaces (Docker SDK)
2
+ FROM python:3.10-slim
3
+
4
+ # Install system dependencies
5
+ RUN apt-get update && apt-get install -y \
6
+ nauty \
7
+ git \
8
+ && rm -rf /var/lib/apt/lists/*
9
+
10
+ # Set working directory
11
+ WORKDIR /app
12
+
13
+ # Copy requirements first (for caching)
14
+ COPY requirements.txt .
15
+
16
+ # Install Python dependencies
17
+ RUN pip install --no-cache-dir -r requirements.txt
18
+
19
+ # Copy the rest of the application
20
+ COPY . .
21
+
22
+ # Install the package itself
23
+ RUN pip install --no-cache-dir -e .
24
+
25
+ # Expose port 7860 (HF Spaces default)
26
+ EXPOSE 7860
27
+
28
+ # Run the app
29
+ CMD ["python", "app.py"]
README.md CHANGED
@@ -3,9 +3,7 @@ title: Ideal Polyhedron Volume Toolkit
3
  emoji: 🔺
4
  colorFrom: blue
5
  colorTo: purple
6
- sdk: gradio
7
- sdk_version: 5.6.0
8
- app_file: app.py
9
  pinned: false
10
  license: mit
11
  ---
 
3
  emoji: 🔺
4
  colorFrom: blue
5
  colorTo: purple
6
+ sdk: docker
 
 
7
  pinned: false
8
  license: mit
9
  ---
app.py CHANGED
@@ -41,7 +41,7 @@ except Exception as e:
41
  gr.Markdown("# Error Loading Application")
42
  gr.Markdown(f"```\n{error_msg}\n```")
43
 
44
- # HuggingFace Spaces will call demo.launch() automatically,
45
- # but we can also run this directly for testing
46
  if __name__ == "__main__":
47
- demo.launch()
 
41
  gr.Markdown("# Error Loading Application")
42
  gr.Markdown(f"```\n{error_msg}\n```")
43
 
44
+ # For Docker SDK on HF Spaces, we must explicitly launch
45
+ # with server_name="0.0.0.0" to bind to all interfaces
46
  if __name__ == "__main__":
47
+ demo.launch(server_name="0.0.0.0", server_port=7860)
requirements.txt CHANGED
@@ -8,4 +8,4 @@ plotly>=5.0
8
  Pillow>=9.0
9
  pynauty>=2.0
10
  gradio==5.6.0
11
- huggingface_hub==0.24.0
 
8
  Pillow>=9.0
9
  pynauty>=2.0
10
  gradio==5.6.0
11
+ huggingface_hub>=0.25.1