Displying plot just like Colab/Jupyterlab in Streamlit using Langchain Pandas Agent

Hi,
I am using the Langchain Pandas agent in Google Colab which is displaying the Bar Chart as expected. Check the attached image bellow

But, when using Streamlit, st.write is just writing the text message, not the bar chart.

Any idea how to solve that?

1 Like

Hi @ifightcode

Yes certainly, there are several options that you can use to display charts in your Streamlit app. st.write although is a magic command but it is primarily for displaying text.

You can use of several Streamlit commands for displaying charts in your Streamlit app in this Streamlit Docs page on Chart elements.

The easiest is to use Streamlit’s built-in st.bar_chart to display the bar chart.

Best regards,
Chanin

I solved the issue by using Matplotlib and pyplot.
But this seems great.
Thanks for sharing.

1 Like

Hi i am trying to experiment as well with langchain agent and charts based on results. Can you please give some guidelines how you achieved this? Any idea how to draw a chart from database results when using SQLDatabaseChain?

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.