Skip to content

Repository files navigation

Chart2CSV

Chart2CSV turns chart images into CSV-style data for analysts and operators who need a quick extraction path from visual reports.

Status: Alpha. Verify extracted values against the source chart before using them.

Try the live demo

Docs · Quick start · API request

Illustrative CSV format (not measured output):

label,valueQ1,42Q2,57

LicensePython


Quick Start

# In one terminal, set MISTRAL_API_KEY in the environment and start the local API:
python -m uvicorn api.main:app --reload
# In another terminal:
curl -X POST "http://127.0.0.1:8000/v1/extract" \
-F "file=@chart.png"

Project Structure

Chart2CSV/
├── api/ # FastAPI REST API
│ └── main.py # API endpoints
├── chart2csv/ # Core Python package
│ ├── core/ # Extraction logic
│ │ ├── llm_extraction.py # Mistral-backed extraction
│ │ ├── pipeline.py # CV pipeline (fallback)
│ │ └── ocr.py # OCR for axis labels
│ └── cli/ # Command-line interface
├── deploy/ # Deployment scripts
│ ├── deploy.sh # Server deployment
│ └── nginx.conf # Nginx config
├── scripts/ # Development utilities
├── Dockerfile # Container build
├── docker-compose.yml # Container orchestration
├── requirements.txt # Python dependencies
└── setup.py # Package installation

Features

FeatureDescription
🧠 Mistral extractionVision-model extraction path
Automatic extractionReads supported charts without manual point selection
📊 Multi-ChartLine, scatter, bar charts
🔧 Manual ModeCalibration endpoint for edge cases
🌐 REST APIFastAPI endpoints for extraction workflows

Powered by Mistral AI


API Endpoints

EndpointDescription
POST /v1/extractLLM extraction (default)
POST /v1/extract/calibratedManual calibration
GET /docsSwagger UI
GET /healthHealth check

Data Handling

The browser demo sends the selected chart image and user-provided API key directly to Mistral. It stores the API key in that browser's localStorage until the field or site data is cleared.

The local API uses MISTRAL_API_KEY for its default LLM-backed extraction path. The CLI uses the local CV/Tesseract path unless --use-mistral is supplied. Mistral-backed modes transmit image data to Mistral.


Installation

pip install -e .

Environment Variables

VariableDescription
MISTRAL_API_KEYMistral AI API key (required for Mistral-backed extraction)

License

AGPL-3.0. Copyright (c) 2025 KikuAI OÜ

KikuAI websiteTelegram @kiku_aiGitHub @kiku-jw

Follow new projects and updates from @kiku-jw.

Releases

Packages

Used by

Contributors

Languages