blank image issue on multiple req
Browse files- controller.py +1 -36
controller.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
# Import necessary modules
|
|
|
2 |
import os
|
3 |
import asyncio
|
4 |
import threading
|
@@ -567,43 +568,7 @@ def handle_out_of_range_float(value):
|
|
567 |
|
568 |
|
569 |
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
import os
|
574 |
-
import asyncio
|
575 |
-
import threading
|
576 |
-
import uuid
|
577 |
-
from fastapi import FastAPI, HTTPException, Header
|
578 |
-
from fastapi.responses import FileResponse
|
579 |
-
from urllib.parse import unquote
|
580 |
-
from pydantic import BaseModel
|
581 |
-
from concurrent.futures import ProcessPoolExecutor
|
582 |
-
import matplotlib.pyplot as plt
|
583 |
-
import matplotlib
|
584 |
-
import pandas as pd
|
585 |
-
import numpy as np
|
586 |
-
import seaborn as sns
|
587 |
-
|
588 |
-
# Import your custom modules (assumed available)
|
589 |
-
from csv_service import clean_data, extract_chart_filenames
|
590 |
-
from langchain_experimental.tools import PythonAstREPLTool
|
591 |
-
from langchain_experimental.agents import create_pandas_dataframe_agent
|
592 |
-
from langchain_groq import ChatGroq
|
593 |
-
from util_service import _prompt_generator, process_answer
|
594 |
-
from intitial_q_handler import if_initial_chart_question
|
595 |
-
|
596 |
-
# Use non-interactive backend
|
597 |
-
matplotlib.use('Agg')
|
598 |
|
599 |
-
# FastAPI app initialization
|
600 |
-
app = FastAPI()
|
601 |
-
|
602 |
-
# Environment variables and configuration
|
603 |
-
import os
|
604 |
-
groq_api_keys = os.getenv("GROQ_API_KEYS", "").split(",")
|
605 |
-
model_name = os.getenv("GROQ_LLM_MODEL")
|
606 |
-
image_file_path = os.getenv("IMAGE_FILE_PATH") # e.g. "/app/generated_charts"
|
607 |
|
608 |
# Global locks for key rotation (chart endpoints)
|
609 |
current_groq_chart_key_index = 0
|
|
|
1 |
# Import necessary modules
|
2 |
+
from concurrent.futures import ProcessPoolExecutor
|
3 |
import os
|
4 |
import asyncio
|
5 |
import threading
|
|
|
568 |
|
569 |
|
570 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
571 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
572 |
|
573 |
# Global locks for key rotation (chart endpoints)
|
574 |
current_groq_chart_key_index = 0
|