Add Matplotlib cache directory and update Dockerfile to create it
Browse files- .gitignore +4 -1
- Dockerfile +2 -1
- app.py +6 -0
.gitignore
CHANGED
@@ -28,4 +28,7 @@ chat_history/*
|
|
28 |
# Hugging Face Space
|
29 |
.streamlit/
|
30 |
stop_space.py
|
31 |
-
/cache/huggingface
|
|
|
|
|
|
|
|
28 |
# Hugging Face Space
|
29 |
.streamlit/
|
30 |
stop_space.py
|
31 |
+
/cache/huggingface
|
32 |
+
|
33 |
+
# Matplotlib cache
|
34 |
+
cache/matplotlib/
|
Dockerfile
CHANGED
@@ -14,7 +14,7 @@ RUN set -x && \
|
|
14 |
|
15 |
# Create directories with secure permissions
|
16 |
RUN set -x && \
|
17 |
-
mkdir -p cache/huggingface vector_store chat_history && \
|
18 |
chown -R 1000:1000 . && \
|
19 |
chmod -R 755 . && \
|
20 |
echo "Directories created successfully"
|
@@ -56,3 +56,4 @@ EXPOSE 8000
|
|
56 |
# CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000", "--log-level", "debug"]
|
57 |
CMD ["python", "app.py"]
|
58 |
|
|
|
|
14 |
|
15 |
# Create directories with secure permissions
|
16 |
RUN set -x && \
|
17 |
+
mkdir -p cache/huggingface cache/matplotlib vector_store chat_history && \
|
18 |
chown -R 1000:1000 . && \
|
19 |
chmod -R 755 . && \
|
20 |
echo "Directories created successfully"
|
|
|
56 |
# CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000", "--log-level", "debug"]
|
57 |
CMD ["python", "app.py"]
|
58 |
|
59 |
+
|
app.py
CHANGED
@@ -2,6 +2,12 @@ import os
|
|
2 |
import sys
|
3 |
import threading
|
4 |
import time
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
import gradio as gr
|
6 |
import uvicorn
|
7 |
import requests
|
|
|
2 |
import sys
|
3 |
import threading
|
4 |
import time
|
5 |
+
|
6 |
+
# Установка конфигурационной директории для Matplotlib
|
7 |
+
os.environ['MPLCONFIGDIR'] = os.path.join(os.getcwd(), 'cache', 'matplotlib')
|
8 |
+
# Создаем директорию с правильными правами
|
9 |
+
os.makedirs(os.environ['MPLCONFIGDIR'], exist_ok=True)
|
10 |
+
|
11 |
import gradio as gr
|
12 |
import uvicorn
|
13 |
import requests
|