Veda0718 commited on
Commit
7d4acc3
·
verified ·
1 Parent(s): 0abfdab

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -1
app.py CHANGED
@@ -61,12 +61,12 @@ class CSVChatbot:
61
  result = self.agent.run(CSV_PROMPT_PREFIX + message + CSV_PROMPT_SUFFIX)
62
  fig = plt.gcf()
63
  if fig.get_axes():
64
- plt.clf()
65
  buf = io.BytesIO()
66
  fig.savefig(buf, format='png')
67
  buf.seek(0)
68
  img_str = base64.b64encode(buf.getvalue()).decode()
69
  img_markdown = f"![plot](data:image/png;base64,{img_str})"
 
70
  plt.close(fig) # Close the figure to free up memory
71
  return result + "\n\n" + img_markdown
72
  else:
 
61
  result = self.agent.run(CSV_PROMPT_PREFIX + message + CSV_PROMPT_SUFFIX)
62
  fig = plt.gcf()
63
  if fig.get_axes():
 
64
  buf = io.BytesIO()
65
  fig.savefig(buf, format='png')
66
  buf.seek(0)
67
  img_str = base64.b64encode(buf.getvalue()).decode()
68
  img_markdown = f"![plot](data:image/png;base64,{img_str})"
69
+ plt.clf() # Clear the figure after saving to buffer
70
  plt.close(fig) # Close the figure to free up memory
71
  return result + "\n\n" + img_markdown
72
  else: