Blog Post

Educator Developer Blog
3 MIN READ

An Overview of LIDA: Generate Visualizations and Infographics of Tabular Data using LLMs!

shreyanfern's avatar
shreyanfern
Brass Contributor
Feb 05, 2024

Generative AI is increasing its boundaries by expanding to every field. Things which merely seemed like a fiction a few years ago are now reality, that’s how Generative AI has proven its existence. To back this up, huge organizations around the world have been inculcating and implementing OpenAI at their firm level to increase the efficiency of work and to aid its workforce.

 

Generative AI which was initially limited to text further moved to multimedia and today we have models like DALL-E and GPT-4 Vision which have proven their potential.

 

All the LLMs have been showcasing their power over the data, but still there are couple of things which LLMs were not able to do to their fullest. Tasks like visualizations needed some improvement. Today we will be looking into such a framework which was again open sourced recently by Microsoft. This is none other than LIDA. LIDA is a powerful library which augments the Granular Data like CSV, Excel, etc. and the LLMs together.

 

LIDA is a library designed for creating data visualizations and faithful infographics. It is agnostic to grammar, meaning it can seamlessly integrate with any programming language and various visualization libraries such as matplotlib, seaborn, Altair, d3, etc. Furthermore, LIDA is compatible with multiple large language model providers like OpenAI, Azure OpenAI Services, PaLM, Cohere, and Hugging face.

 

LIDA comprises of 4 modules –

 

1.SUMMARIZER: This converts data into a rich but compact natural language summary

2.GOAL EXPLORER: This enumerates visualization goals given the data.

3.VISGENERATOR: This generates, refines, executes and filters visualization code

 4.INFOGRAPHER: This is the module that yields data-faithful stylized graphics using IGMs.

 

LIDA provides a python API, and a hybrid user interface (direct manipulation and multilingual natural language) for interactive chart, infographics and data story generation.

 

LIDA can be installed using a simple command in python,( Use a python terminal/VS Code to run this command) 

 

pip install lida

 

 

 

After collecting all the packages, LIDA is now ready on your local machine!!

 

Note: For LIDA to get properly installed in local machine, the python version should be 3.10 or higher (preferably, use Conda). Install the library via pip.

Once this installation is done, setup the API key,

 

 

export OPENAI_API_KEY=<your key>

 

Or If using Azure OpenAI Services 

 

export AZURE_OPENAI_API_KEY=<your key>​

 

 

LIDA comes with an optional bundled UI and web API which can be explored using the following command,

 

 

lida ui  --port=8080 --docs

 

 

Note: If you are not able to set your API key in the .env file, then follow the following steps:

  1. Launch “Control Panel” à “System and Security”
  2. “System”
  3. “Advanced system settings”
  4. Switch to “Advanced” tab
  5. “Environment variables”
  6. Choose “User Variable” (so that only you are able to access the keys and not any other accounts)
  7. To add a new environment variable: Choose “New”
  8. Enter the variable name “OPENAI_API_KEY” and the actual API string then save it.

 

Upon successful execution, we can now see a webpage.

 

 

There is a section named “Demo” on this webpage. This is like a playground of LIDA. Upload any .csv or .json which needs to be visualized and the model which needs to be used. One can also select the library needed for visualization.


For demonstration purposes I have used the “stocks.csv” file which is already available on the webpage and following are the results,

 

One can also Refine, Get explanation , Evaluate and Get some recommendations from LIDA.


LIDA treats visualizations as code and provides a clean API for generating, executing, editing, explaining, evaluating and repairing visualization code.

  • Data Summarization
  • Goal Generation
  • Visualization Generation
  • Visualization Editing
  • Visualization Explanation
  • Visualization Evaluation and Repair
  • Visualization Recommendation
  • Infographic Generation

System Architecture for LIDA is as follows:

 

LIDA: Automatic Generation of Grammar Agnostic Visualizations and Infographics with Large Language Models from Victor Dibia on Vimeo.

 

In conclusion, LIDA is a great tool which will enable Data Enthusiasts to explore data in a easier way using the power of Generative AI!

Updated Feb 05, 2024
Version 6.0
  • naivedya's avatar
    naivedya
    Copper Contributor

    Is LIDA still being developed? Because I haven't seen any updates regarding LIDA for quite some time.