Kazel commited on
Commit
3e2041e
·
1 Parent(s): 0400df3
Files changed (5) hide show
  1. .dockerignore +41 -0
  2. .gitignore +57 -0
  3. Dockerfile +32 -0
  4. app.py +5 -1
  5. requirements.txt +10 -1
.dockerignore ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Git
2
+ .git
3
+ .gitignore
4
+
5
+ # Documentation
6
+ *.md
7
+ !README.md
8
+ !QUICK_START.md
9
+
10
+ # Test files
11
+ test_*.py
12
+ *_test.py
13
+
14
+ # Temporary files
15
+ temp/
16
+ volumes/
17
+ __pycache__/
18
+
19
+ # Database
20
+ app_database.db
21
+ *.db
22
+
23
+ # Environment files
24
+ .env
25
+ .env.*
26
+
27
+ # IDE
28
+ .vscode/
29
+ .idea/
30
+
31
+ # OS
32
+ .DS_Store
33
+ Thumbs.db
34
+
35
+ # Large model files
36
+ *.safetensors
37
+ *.bin
38
+ *.ckpt
39
+
40
+ # Circuit diagrams
41
+ circuit_diagram_*.png
.gitignore ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Python
2
+ __pycache__/
3
+ *.pyc
4
+ *.pyo
5
+ *.pyd
6
+ .Python
7
+ *.so
8
+
9
+ # Environment variables
10
+ .env
11
+ .env.local
12
+ .env.production
13
+
14
+ # Database
15
+ app_database.db
16
+ *.db
17
+ *.sqlite
18
+
19
+ # Temporary files
20
+ temp/
21
+ volumes/
22
+ *.tmp
23
+ *.temp
24
+
25
+ # Logs
26
+ *.log
27
+ logs/
28
+
29
+ # IDE
30
+ .vscode/
31
+ .idea/
32
+ *.swp
33
+ *.swo
34
+
35
+ # OS
36
+ .DS_Store
37
+ Thumbs.db
38
+
39
+ # Model files (large files)
40
+ *.safetensors
41
+ *.bin
42
+ *.ckpt
43
+
44
+ # Circuit diagrams
45
+ circuit_diagram_*.png
46
+
47
+ # Test files
48
+ test_*.py
49
+ *_test.py
50
+
51
+ # Documentation
52
+ *.md
53
+ !README.md
54
+ !QUICK_START.md
55
+
56
+ # Docker
57
+ docker-compose.yml
Dockerfile ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.9-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
+ curl \
10
+ && rm -rf /var/lib/apt/lists/*
11
+
12
+ # Copy requirements first for better caching
13
+ COPY requirements.txt .
14
+
15
+ # Install Python dependencies
16
+ RUN pip install --no-cache-dir -r requirements.txt
17
+
18
+ # Copy application code
19
+ COPY . .
20
+
21
+ # Create necessary directories
22
+ RUN mkdir -p pages temp
23
+
24
+ # Expose port
25
+ EXPOSE 7860
26
+
27
+ # Set environment variables
28
+ ENV PYTHONPATH=/app
29
+ ENV PYTHONUNBUFFERED=1
30
+
31
+ # Run the application
32
+ CMD ["python", "app.py"]
app.py CHANGED
@@ -356,7 +356,11 @@ def start_services():
356
  print("All Docker containers are already running.")
357
 
358
 
359
- start_services()
 
 
 
 
360
 
361
  def generate_uuid(state):
362
  # Check if UUID already exists in session state
 
356
  print("All Docker containers are already running.")
357
 
358
 
359
+ # Skip Docker services when running on Hugging Face Spaces
360
+ if not os.getenv("SPACE_ID"):
361
+ start_services()
362
+ else:
363
+ print("Running on Hugging Face Spaces - skipping Docker services")
364
 
365
  def generate_uuid(state):
366
  # Check if UUID already exists in session state
requirements.txt CHANGED
@@ -16,4 +16,13 @@ schemdraw
16
  matplotlib
17
  python-docx>=0.8.11
18
  openpyxl>=3.1.2
19
- pandas>=2.0.0
 
 
 
 
 
 
 
 
 
 
16
  matplotlib
17
  python-docx>=0.8.11
18
  openpyxl>=3.1.2
19
+ pandas>=2.0.0
20
+
21
+ # Hugging Face Spaces dependencies
22
+ spaces>=0.0.1
23
+
24
+ # Google Gemini API
25
+ google-generativeai>=0.3.0
26
+
27
+ # Additional utilities
28
+ psutil>=5.9.0