Soumik555 commited on
Commit
282f670
·
1 Parent(s): 571ceb5

blank image issue on multiple req

Browse files
Files changed (2) hide show
  1. Dockerfile +3 -0
  2. controller.py +2 -2
Dockerfile CHANGED
@@ -13,6 +13,9 @@ RUN mkdir -p /app/cache && chmod -R 777 /app/cache
13
  # Create the log file and set permissions
14
  RUN touch /app/pandasai.log && chmod 666 /app/pandasai.log
15
 
 
 
 
16
  # Copy the requirements file first
17
  COPY requirements.txt .
18
 
 
13
  # Create the log file and set permissions
14
  RUN touch /app/pandasai.log && chmod 666 /app/pandasai.log
15
 
16
+ # Set the MPLCONFIGDIR environment variable to a writable directory
17
+ ENV MPLCONFIGDIR=/tmp/matplotlib
18
+
19
  # Copy the requirements file first
20
  COPY requirements.txt .
21
 
controller.py CHANGED
@@ -38,6 +38,7 @@ os.makedirs("/app/cache", exist_ok=True)
38
 
39
  os.makedirs("/app", exist_ok=True)
40
  open("/app/pandasai.log", "a").close() # Create the file if it doesn't exist
 
41
 
42
  # Ensure the generated_charts directory exists
43
  os.makedirs("/app/generated_charts", exist_ok=True)
@@ -602,8 +603,7 @@ app = FastAPI()
602
  # Ensure necessary directories exist
603
  os.makedirs("/app/generated_charts", exist_ok=True)
604
 
605
- # Environment variables and configuration
606
- import os
607
  groq_api_keys = os.getenv("GROQ_API_KEYS", "").split(",")
608
  model_name = os.getenv("GROQ_LLM_MODEL")
609
  image_file_path = os.getenv("IMAGE_FILE_PATH") # e.g. "/app/generated_charts"
 
38
 
39
  os.makedirs("/app", exist_ok=True)
40
  open("/app/pandasai.log", "a").close() # Create the file if it doesn't exist
41
+ os.environ['MPLCONFIGDIR'] = '/tmp/matplotlib'
42
 
43
  # Ensure the generated_charts directory exists
44
  os.makedirs("/app/generated_charts", exist_ok=True)
 
603
  # Ensure necessary directories exist
604
  os.makedirs("/app/generated_charts", exist_ok=True)
605
 
606
+
 
607
  groq_api_keys = os.getenv("GROQ_API_KEYS", "").split(",")
608
  model_name = os.getenv("GROQ_LLM_MODEL")
609
  image_file_path = os.getenv("IMAGE_FILE_PATH") # e.g. "/app/generated_charts"