Spaces:
Runtime error
Runtime error
Really-amin
commited on
Commit
•
e6c218c
1
Parent(s):
6aaf3c3
Upload 4 files
Browse files- docker-compose.yml +36 -11
- dockerfile +24 -18
- prometheus-config.json +9 -0
- requirements.txt +12 -34
docker-compose.yml
CHANGED
@@ -1,18 +1,43 @@
|
|
1 |
version: '3.8'
|
2 |
|
3 |
services:
|
4 |
-
|
5 |
-
build:
|
6 |
-
|
7 |
-
|
8 |
-
|
|
|
9 |
ports:
|
10 |
-
- "
|
11 |
environment:
|
12 |
-
-
|
13 |
-
-
|
14 |
-
-
|
15 |
-
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
volumes:
|
17 |
-
- ./
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
restart: unless-stopped
|
|
|
|
|
|
|
|
|
|
1 |
version: '3.8'
|
2 |
|
3 |
services:
|
4 |
+
bloom-ai:
|
5 |
+
build: .
|
6 |
+
container_name: bloom-ai-assistant
|
7 |
+
volumes:
|
8 |
+
- ./app:/app
|
9 |
+
- model-cache:/app/cache
|
10 |
ports:
|
11 |
+
- "8000:8000"
|
12 |
environment:
|
13 |
+
- HF_HOME=/app/cache
|
14 |
+
- TRANSFORMERS_CACHE=/app/cache
|
15 |
+
- TORCH_HOME=/app/cache/torch
|
16 |
+
- PYTHONUNBUFFERED=1
|
17 |
+
- PYTHONDONTWRITEBYTECODE=1
|
18 |
+
restart: unless-stopped
|
19 |
+
healthcheck:
|
20 |
+
test: ["CMD", "curl", "-f", "http://localhost:8000/"]
|
21 |
+
interval: 30s
|
22 |
+
timeout: 10s
|
23 |
+
retries: 3
|
24 |
+
start_period: 40s
|
25 |
+
|
26 |
+
prometheus:
|
27 |
+
image: prom/prometheus:latest
|
28 |
+
container_name: bloom-ai-prometheus
|
29 |
volumes:
|
30 |
+
- ./prometheus.yml:/etc/prometheus/prometheus.yml
|
31 |
+
- prometheus-data:/prometheus
|
32 |
+
ports:
|
33 |
+
- "9090:9090"
|
34 |
+
command:
|
35 |
+
- '--config.file=/etc/prometheus/prometheus.yml'
|
36 |
+
- '--storage.tsdb.path=/prometheus'
|
37 |
+
- '--web.console.libraries=/usr/share/prometheus/console_libraries'
|
38 |
+
- '--web.console.templates=/usr/share/prometheus/consoles'
|
39 |
restart: unless-stopped
|
40 |
+
|
41 |
+
volumes:
|
42 |
+
model-cache:
|
43 |
+
prometheus-data:
|
dockerfile
CHANGED
@@ -1,31 +1,37 @@
|
|
1 |
FROM python:3.10-slim
|
2 |
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
4 |
|
5 |
# Install system dependencies
|
6 |
-
RUN apt-get update && \
|
7 |
-
apt-get install -y --no-install-recommends \
|
8 |
build-essential \
|
|
|
|
|
|
|
9 |
&& rm -rf /var/lib/apt/lists/*
|
10 |
|
11 |
-
#
|
12 |
-
|
13 |
-
chmod -R 777 /app/.cache
|
14 |
-
|
15 |
-
# Set environment variable
|
16 |
-
ENV HF_HOME=/app/.cache/huggingface
|
17 |
|
18 |
-
#
|
19 |
COPY requirements.txt .
|
20 |
-
RUN pip install --no-cache-dir -
|
|
|
21 |
|
22 |
-
#
|
23 |
-
|
24 |
-
chmod -R 755 /app/static
|
25 |
|
26 |
-
#
|
27 |
-
|
|
|
28 |
|
29 |
-
|
|
|
30 |
|
31 |
-
|
|
|
|
1 |
FROM python:3.10-slim
|
2 |
|
3 |
+
# Set environment variables
|
4 |
+
ENV PYTHONUNBUFFERED=1 \
|
5 |
+
PYTHONDONTWRITEBYTECODE=1 \
|
6 |
+
HF_HOME=/app/cache \
|
7 |
+
TRANSFORMERS_CACHE=/app/cache \
|
8 |
+
TORCH_HOME=/app/cache/torch
|
9 |
|
10 |
# Install system dependencies
|
11 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
|
12 |
build-essential \
|
13 |
+
curl \
|
14 |
+
git \
|
15 |
+
libpq-dev \
|
16 |
&& rm -rf /var/lib/apt/lists/*
|
17 |
|
18 |
+
# Set working directory
|
19 |
+
WORKDIR /app
|
|
|
|
|
|
|
|
|
20 |
|
21 |
+
# Install Python dependencies first
|
22 |
COPY requirements.txt .
|
23 |
+
RUN pip install --no-cache-dir torch --index-url https://download.pytorch.org/whl/cpu && \
|
24 |
+
pip install --no-cache-dir -r requirements.txt
|
25 |
|
26 |
+
# Copy project files
|
27 |
+
COPY . .
|
|
|
28 |
|
29 |
+
# Create necessary directories
|
30 |
+
RUN mkdir -p /app/cache /app/logs /app/static /app/templates && \
|
31 |
+
chmod -R 777 /app
|
32 |
|
33 |
+
# Expose port
|
34 |
+
EXPOSE 8000
|
35 |
|
36 |
+
# Start command
|
37 |
+
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"]
|
prometheus-config.json
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
global:
|
2 |
+
scrape_interval: 15s
|
3 |
+
evaluation_interval: 15s
|
4 |
+
|
5 |
+
scrape_configs:
|
6 |
+
- job_name: 'bloom-ai'
|
7 |
+
static_configs:
|
8 |
+
- targets: ['bloom-ai:8000']
|
9 |
+
metrics_path: '/metrics'
|
requirements.txt
CHANGED
@@ -4,20 +4,14 @@ uvicorn[standard]>=0.24.0
|
|
4 |
python-multipart>=0.0.6
|
5 |
jinja2>=3.1.2
|
6 |
|
7 |
-
# Telegram and Communication
|
8 |
-
python-telegram-bot>=20.7
|
9 |
-
httpx[http2,socks]>=0.25.2
|
10 |
-
websockets>=12.0
|
11 |
-
discord.py>=2.3.2
|
12 |
-
|
13 |
# AI and Machine Learning
|
14 |
-
torch
|
15 |
-
transformers
|
16 |
-
sentence-transformers
|
17 |
accelerate>=0.26.0
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
|
22 |
# Async and Network
|
23 |
aiofiles>=23.2.1
|
@@ -40,28 +34,12 @@ plotly>=5.18.0
|
|
40 |
pillow>=10.1.0
|
41 |
bs4>=0.0.1
|
42 |
|
43 |
-
# Database and Authentication
|
44 |
-
sqlalchemy>=2.0.23
|
45 |
-
python-jose[cryptography]>=3.3.0
|
46 |
-
passlib[bcrypt]>=1.7.4
|
47 |
-
social-auth-core>=4.5.0
|
48 |
-
|
49 |
-
# Task Scheduling and Management
|
50 |
-
apscheduler>=3.10.4
|
51 |
-
eventlet>=0.33.3
|
52 |
-
|
53 |
-
# UI and Visualization
|
54 |
-
dash>=2.14.1
|
55 |
-
gradio>=4.7.1
|
56 |
-
flask-socketio>=5.3.6
|
57 |
-
|
58 |
# Environment and Configuration
|
59 |
python-dotenv>=1.0.0
|
60 |
-
|
61 |
-
# Optional but Recommended
|
62 |
pydantic>=2.5.2
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
|
|
|
4 |
python-multipart>=0.0.6
|
5 |
jinja2>=3.1.2
|
6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
# AI and Machine Learning
|
8 |
+
torch==2.1.1+cpu
|
9 |
+
transformers==4.35.2
|
10 |
+
sentence-transformers==2.2.2
|
11 |
accelerate>=0.26.0
|
12 |
+
hazm==0.7.0
|
13 |
+
protobuf==4.25.1
|
14 |
+
sentencepiece==0.1.99
|
15 |
|
16 |
# Async and Network
|
17 |
aiofiles>=23.2.1
|
|
|
34 |
pillow>=10.1.0
|
35 |
bs4>=0.0.1
|
36 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
# Environment and Configuration
|
38 |
python-dotenv>=1.0.0
|
|
|
|
|
39 |
pydantic>=2.5.2
|
40 |
+
|
41 |
+
# HTTP Client
|
42 |
+
httpx[http2,socks]>=0.25.2
|
43 |
+
|
44 |
+
# Cache and Storage
|
45 |
+
cachetools>=5.3.2
|