File size: 1,678 Bytes
d1e9d0b
f45d315
 
 
 
 
 
d1e9d0b
 
f45d315
 
d1e9d0b
 
 
 
f1a0c7b
 
 
 
ee1b44b
f1a0c7b
 
 
 
 
 
 
 
 
 
ee1b44b
 
f1a0c7b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
---
title: Electrol Roll
emoji: 🌍
colorFrom: purple
colorTo: gray
sdk: gradio
sdk_version: 5.33.0
app_file: app.py
pinned: false
license: mit
short_description: Gradio app for the Electrol  csv
---

Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference

# πŸ—³οΈ Hindi Voter PDF Processor with LLM API (OCR + OpenRouter + Gradio)

This app extracts voter information from scanned PDFs using OCR and formats it into a structured CSV using an LLM API (via [OpenRouter](https://openrouter.ai/)).

---

## πŸ“¦ Features

- Extracts text from Hindi/English PDFs using EasyOCR
- Splits content to avoid LLM token limits
- Sends chunked JSON to LLM for conversion to clean CSV
- Uses OpenRouter LLM API (e.g., Gemma-3b)
- Interactive UI with Gradio
- Supports download of extracted JSON and final CSV

---


## 🌐 Get Your OpenRouter API Key
- Go to https://openrouter.ai

- Click Login (use Google/GitHub/Email)

- Navigate to the Models page

- Click on a model like gemma-3b, mistral, etc.

- On the model page, click "Create API Key"

- Copy the API key


## πŸ§ͺ How to Use the Gradio App
### πŸ”Ή Tab 1: PDF Processing
- Upload a Hindi/English scanned PDF

- Click "Process PDF"

- View extracted text in JSON format

- Download JSON file if needed

### πŸ”Ή Tab 2: LLM API Processing
- Paste your OpenRouter API key

- (Optional) Customize the prompt or add instructions

- Click "Call LLM API"

- View structured voter data in CSV format

- Download the CSV file

- Enable Debug Mode to see raw API responses for troubleshooting.


### πŸ“ Output Files
Extracted JSON and CSV files are saved in the processed_json/ folder.