Metadata-Version: 2.4
Name: graphvision-ai
Version: 0.1.13
Summary: Automatic Graph Classification and Data Extraction
Author: Aryan Gahlot
License: MIT License
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: torch
Requires-Dist: torchvision
Requires-Dist: opencv-python-headless
Requires-Dist: easyocr
Requires-Dist: Pillow
Requires-Dist: numpy
Requires-Dist: huggingface_hub
Requires-Dist: ultralytics
Dynamic: license-file

# GraphVision AI 📊👁️

GraphVision AI is a lightweight, powerful computer vision library for automatic graph classification and structured data extraction.

Built with PyTorch and EasyOCR, it is designed to look at an image of a chart, instantly recognize what kind of graph it is, and extract its labels and values into a clean, developer-friendly JSON format.

---

## ✨ Key Features

### 🚀 Zero-Configuration
Models and weights are automatically downloaded from Hugging Face the first time you run it. No manual weight management required.

### 🧠 Intelligent Routing
Automatically classifies the input image (Pie, Vertical Bar, Horizontal Bar, Line, etc.) and routes it to the correct extraction algorithm.

### 🖼 Robust Input Handling
Pass a file path (`String`), an OpenCV image (`NumPy array`), or a `PIL Image` directly into the analyzer.

### 🔍 Smart OCR Masking
Uses contrast filtering and spatial mapping to accurately match text labels with their corresponding graphical data points.

---

## 📦 Installation

Install directly from PyPI:

```bash
pip install graphvision-ai
```


## 🚀 Quick Start

Extracting data from a graph takes less than 5 lines of code:


```
from graphvision.extractor import GraphExtractor
import json

try:
    vision_engine = GraphExtractor()
    
    # Path to your test image
    image_to_test = "hbar2.png" 
    
    # Run the extraction
    result = vision_engine.extract_data(image_to_test)
    
    print("\n✅ Extraction Successful!")
    print(json.dumps(result, indent=4))

except Exception as e:
    print(f"\n❌ Error during testing: {e}")
```

## 📄 Example Output

```
{
    "type": "pie",
    "title": "Favorite Programming Languages",
    "data": {
        "Python": 45.2,
        "JavaScript": 25.1,
        "C++": 15.4,
        "Java": 14.3
    }
}
```


## 📈 Supported Graph Types

Currently, GraphVision AI supports high-accuracy extraction for:

- `pie` — Pie Charts  
- `vbar_categorical` — Vertical Bar Charts  
- `hbar_categorical` — Horizontal Bar Charts  

Line and Dot-Line charts coming soon.
