chmielvu commited on
Commit
34ee480
·
verified ·
1 Parent(s): 1712ab6

Upload folder using huggingface_hub

Browse files
Files changed (3) hide show
  1. Dockerfile +26 -2
  2. README.md +60 -5
  3. requirements.txt +90 -4
Dockerfile CHANGED
@@ -1,14 +1,38 @@
1
  FROM python:3.12-slim
2
 
 
 
 
 
 
 
3
  RUN useradd -m -u 1000 user
4
  WORKDIR /app
5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  COPY --chown=user requirements.txt /app/requirements.txt
7
- RUN pip install --no-cache-dir -U pip && pip install --no-cache-dir -r /app/requirements.txt
8
 
 
 
 
9
  COPY --chown=user . /app
10
 
11
  USER user
12
  ENV HOME=/home/user PATH=/home/user/.local/bin:$PATH
13
 
14
- CMD ["waitress-serve", "--host=0.0.0.0", "--port=7860", "python_executor:app"]
 
1
  FROM python:3.12-slim
2
 
3
+ # Install system dependencies for audio/image processing
4
+ RUN apt-get update && apt-get install -y --no-install-recommends \
5
+ ffmpeg \
6
+ libsndfile1 \
7
+ && rm -rf /var/lib/apt/lists/*
8
+
9
  RUN useradd -m -u 1000 user
10
  WORKDIR /app
11
 
12
+ # -------------------------------------------
13
+ # Step 1: Install PyTorch CPU-only (pinned to 2.5.1 for PyG compatibility)
14
+ # -------------------------------------------
15
+ RUN pip install --no-cache-dir -U pip && \
16
+ pip install --no-cache-dir torch==2.5.1+cpu torchvision==0.20.1+cpu --index-url https://download.pytorch.org/whl/cpu
17
+
18
+ # -------------------------------------------
19
+ # Step 2: Install PyTorch Geometric + extensions (CPU)
20
+ # -------------------------------------------
21
+ RUN pip install --no-cache-dir torch_geometric && \
22
+ pip install --no-cache-dir pyg_lib torch_scatter torch_sparse torch_cluster -f https://data.pyg.org/whl/torch-2.5.1+cpu.html
23
+
24
+ # -------------------------------------------
25
+ # Step 3: Install remaining requirements
26
+ # -------------------------------------------
27
  COPY --chown=user requirements.txt /app/requirements.txt
28
+ RUN pip install --no-cache-dir -r /app/requirements.txt
29
 
30
+ # -------------------------------------------
31
+ # Step 4: Copy application
32
+ # -------------------------------------------
33
  COPY --chown=user . /app
34
 
35
  USER user
36
  ENV HOME=/home/user PATH=/home/user/.local/bin:$PATH
37
 
38
+ CMD ["waitress-serve", "--host=0.0.0.0", "--port=7860", "python_executor:app"]
README.md CHANGED
@@ -7,9 +7,64 @@ sdk: docker
7
  app_port: 7860
8
  ---
9
 
10
- Remote Python executor for Knowledge Graph of Thoughts.
11
 
12
- Exposes:
13
- - `GET /` basic service info
14
- - `GET /health` health check
15
- - `POST /run` code execution endpoint compatible with the KGoT Python tool
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  app_port: 7860
8
  ---
9
 
10
+ Remote Python executor for Knowledge Graph of Thoughts with comprehensive ML/data science capabilities.
11
 
12
+ ## Hardware
13
+ - **CPU Basic** (Free): 2 vCPU, 16GB RAM, 50GB ephemeral disk
14
+
15
+ ## Included Libraries
16
+
17
+ ### Core Data
18
+ - numpy, pandas
19
+
20
+ ### NLP
21
+ - nltk, spacy, transformers, textblob, gensim, fastembed
22
+
23
+ ### Vision
24
+ - pillow, opencv-python-headless, torchvision, scikit-image
25
+
26
+ ### Advanced Data
27
+ - polars, duckdb, sktime
28
+
29
+ ### Time Series & Graph
30
+ - torch (CPU), torch_geometric, networkx
31
+ - pyg_lib, torch_scatter, torch_sparse, torch_cluster
32
+
33
+ ### Audio
34
+ - pydub, soundfile, librosa
35
+
36
+ ### Documents
37
+ - python-docx, csvkit, rich, svgwrite, svgpathtools, PyMuPDF
38
+
39
+ ### Utilities
40
+ - pydantic, tqdm, ipython, click, tenacity, ujson, msgpack, xxhash, zstandard, httpx
41
+
42
+ ### ML
43
+ - scikit-learn, joblib
44
+
45
+ ### Visualization
46
+ - matplotlib, seaborn
47
+
48
+ ## API Endpoints
49
+
50
+ - `GET /` - Basic service info
51
+ - `GET /health` - Health check
52
+ - `POST /run` - Code execution endpoint
53
+
54
+ ### POST /run
55
+ ```python
56
+ {
57
+ "required_modules": ["list", "of", "packages"], # Optional - auto-install
58
+ "code": "python code to execute"
59
+ }
60
+ ```
61
+
62
+ Returns:
63
+ ```python
64
+ {
65
+ "output": "execution output"
66
+ }
67
+ ```
68
+
69
+ ## Timeout
70
+ - Maximum execution time: 240 seconds
requirements.txt CHANGED
@@ -1,4 +1,90 @@
1
- flask
2
- waitress
3
- requests
4
- langchain_experimental
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ===========================================
2
+ # KGoT Python Executor - Enhanced Requirements
3
+ # ===========================================
4
+
5
+ # Existing - Flask server
6
+ flask>=3.0.0
7
+ waitress>=3.0.0
8
+ langchain_experimental>=0.0.60
9
+ requests>=2.31.0
10
+
11
+ # -------------------------------------------
12
+ # Core Data
13
+ # -------------------------------------------
14
+ numpy>=1.26.0
15
+ pandas>=2.2.0
16
+
17
+ # -------------------------------------------
18
+ # NLP
19
+ # -------------------------------------------
20
+ nltk>=3.8
21
+ spacy>=3.7.0
22
+ transformers>=4.40.0
23
+ textblob>=0.18.0
24
+ gensim>=4.3.0
25
+ fastembed>=0.2.0
26
+
27
+ # -------------------------------------------
28
+ # Vision
29
+ # -------------------------------------------
30
+ pillow>=10.0.0
31
+ opencv-python-headless>=4.9.0
32
+ scikit-image>=0.22.0
33
+ # torchvision installed via Dockerfile (CPU-only)
34
+
35
+ # -------------------------------------------
36
+ # Advanced Data
37
+ # -------------------------------------------
38
+ polars>=0.20.0
39
+ duckdb>=0.10.0
40
+ sktime>=0.26.0
41
+
42
+ # -------------------------------------------
43
+ # Time Series & Graph
44
+ # -------------------------------------------
45
+ networkx>=3.2
46
+ # torch, torch_geometric, pyg_lib, torch_scatter, torch_sparse, torch_cluster
47
+ # installed via Dockerfile for CPU-only versions
48
+
49
+ # -------------------------------------------
50
+ # Audio
51
+ # -------------------------------------------
52
+ pydub>=0.25.0
53
+ soundfile>=0.12.0
54
+ librosa>=0.10.0
55
+
56
+ # -------------------------------------------
57
+ # Documents
58
+ # -------------------------------------------
59
+ python-docx>=1.1.0
60
+ csvkit>=2.0.0
61
+ rich>=13.0.0
62
+ svgwrite>=1.4.0
63
+ svgpathtools>=1.6.0
64
+ PyMuPDF>=1.24.0
65
+
66
+ # -------------------------------------------
67
+ # Utilities
68
+ # -------------------------------------------
69
+ pydantic>=2.6.0
70
+ tqdm>=4.66.0
71
+ ipython>=8.20.0
72
+ click>=8.1.0
73
+ tenacity>=8.2.0
74
+ ujson>=5.9.0
75
+ msgpack>=1.0.7
76
+ xxhash>=3.4.0
77
+ zstandard>=0.22.0
78
+ httpx>=0.27.0
79
+
80
+ # -------------------------------------------
81
+ # ML
82
+ # -------------------------------------------
83
+ scikit-learn>=1.4.0
84
+ joblib>=1.3.0
85
+
86
+ # -------------------------------------------
87
+ # Visualization
88
+ # -------------------------------------------
89
+ matplotlib>=3.8.0
90
+ seaborn>=0.13.0