Upload a CSV, describe the analysis you want, and let the LLM generate and execute Python code (pandas + matplotlib) to answer your question.
- Upload any CSV at runtime (no hardcoded
data.csv). - LLM-generated analysis code with safety checks before execution.
- Preview data, see generated code, view resulting table and chart.
- Python 3.10+
- A Groq API key stored in
.envasGROQ_API_KEY=<your_key>.
- Create and activate a virtual environment:
python -m venv venv . venv/Scripts/activate # Windows source venv/bin/activate # macOS/Linux
- Install dependencies:
pip install -r requirements.txt
- Create
.envwith your Groq key:echo GROQ_API_KEY=your_key_here > .env
streamlit run app.pyThen upload a CSV and enter your analysis prompt (e.g., "Show total sales per region as a bar chart").
- Try it in the browser: https://llm-data-analysis-executor.streamlit.app/
- The repository includes a sample sales file data.csv you can upload for quick trials.
app.py: Streamlit UI for upload, preview, LLM invocation, and result display.prompt.py: Builds the LLM prompt using the uploaded file path and schema.llm.py: Calls Groq to generate analysis code.executor.py: Validates and executes generated code with restricted imports.schema.py: Reads column names from the uploaded CSV to inform the prompt.
- Only pandas and matplotlib are allowed in generated code; writing files is limited to
output.png. - Uploaded CSV is saved to a temporary path for the duration of the Streamlit session.