📊 Build an AI-Powered Chart Generator with Streamlit & Mistral (English Dub included!)

Hey Streamlit Community! :waving_hand:

I wanted to share a project that I think many of you will find useful, especially if you’re interested in combining LLMs with data visualization.

I’ve built a “Smart Data Analyst” app using Streamlit and Mistral AI. The concept is simple but powerful: you upload a CSV file, and the AI analyzes the data, suggests relevant visualizations, and—here is the best part—generates the actual Python code to render them using Plotly.

:globe_showing_europe_africa: A Note on Language Accessibility
The original tutorial was recorded in Spanish, but thanks to YouTube’s AI dubbing features, an English audio track is available! It’s a great example of how we can share coding knowledge across language barriers.

In this tutorial, we cover:

  • :rocket: Setting up the Streamlit interface with streamlit-lottie for animations.

  • :brain: Integrating the Mistral AI API to analyze tabular data.

  • :snake: Using Python’s exec() function safely to run AI-generated code dynamically.

  • :chart_increasing: Rendering interactive charts with Plotly Express.

  • :open_file_folder: Displaying the source code alongside the chart for learning purposes.

Check it out here:
:television: Video Tutorial:

:laptop: Source Code:

The repository is open for you to clone, explore, and modify. It’s a great starting point if you want to build your own “Talk to your Data” application.

I’d love to hear your thoughts or see how you adapt this for your own datasets!

Happy coding! :balloon: