blank image issue on multiple req
Browse files- controller.py +6 -0
- intitial_q_handler.py +1 -1
controller.py
CHANGED
@@ -629,6 +629,9 @@ def groq_chart(csv_url: str, question: str):
|
|
629 |
"""
|
630 |
answer = df.chat(question + instructions)
|
631 |
|
|
|
|
|
|
|
632 |
# If process_answer indicates a problem, return a failure message.
|
633 |
if process_answer(answer):
|
634 |
return "Chart not generated"
|
@@ -691,6 +694,9 @@ def langchain_csv_chart(csv_url: str, question: str, chart_required: bool):
|
|
691 |
result = agent.invoke({"input": _prompt_generator(question, True)})
|
692 |
output = result.get("output", "")
|
693 |
|
|
|
|
|
|
|
694 |
# Extract chart filenames (assuming extract_chart_filenames returns a list)
|
695 |
chart_files = extract_chart_filenames(output)
|
696 |
if len(chart_files) > 0:
|
|
|
629 |
"""
|
630 |
answer = df.chat(question + instructions)
|
631 |
|
632 |
+
# Make sure to close figures so they don't conflict between processes
|
633 |
+
plt.close('all')
|
634 |
+
|
635 |
# If process_answer indicates a problem, return a failure message.
|
636 |
if process_answer(answer):
|
637 |
return "Chart not generated"
|
|
|
694 |
result = agent.invoke({"input": _prompt_generator(question, True)})
|
695 |
output = result.get("output", "")
|
696 |
|
697 |
+
# Close figures to avoid interference
|
698 |
+
plt.close('all')
|
699 |
+
|
700 |
# Extract chart filenames (assuming extract_chart_filenames returns a list)
|
701 |
chart_files = extract_chart_filenames(output)
|
702 |
if len(chart_files) > 0:
|
intitial_q_handler.py
CHANGED
@@ -4,7 +4,7 @@ INITIAL_CHAT_QUESTIONS = [
|
|
4 |
]
|
5 |
|
6 |
INITIAL_CHART_QUESTIONS = [
|
7 |
-
"Can you provide a visualization of the data?",
|
8 |
]
|
9 |
|
10 |
def if_initial_chat_question(query: str) -> bool:
|
|
|
4 |
]
|
5 |
|
6 |
INITIAL_CHART_QUESTIONS = [
|
7 |
+
"Can you provide a bar visualization of the data?",
|
8 |
]
|
9 |
|
10 |
def if_initial_chat_question(query: str) -> bool:
|