Problem Statement: [BharatX] Build a Family Tree
Team Name: Project ONN
Contributors:
Steps to setup the API:
- Clone the repo
- Change working directory
cd captch_solver
- Create a virtualenv
python -m venv venv
- Activate the created virtualenv
. venv/bin/activate
- Execute the following command:
sudo apt install tesseract-ocr
sudo apt install tesseract-ocr-tam
- Install all the requirements (Note: There are a lot of dependencies, hence it might take some time)
pip install -r requirements.txt
-
Download the model files for CRAFT model from here and for TPS-ResNet-BiLSTM-Attn-case-sensitive from here and place them both inside the captch_solver folder.
-
Change the Chrome Driver filepath in this line to the path where your Chrome Driver has been installed. (Download the Chrome Driver corresponding to your Google Chrome version here)
-
Run the API using the following command (Note: Our captcha and transliteration model needs time to setup, it might take some time to get the API started)
python3 api.py
- Visit
localhost:8000
to check if the API is working. - To search any records, send a POST request to
localhost:8000/getpdfinfo
in the following JSON format.
{
"name" : "<Some name>",
"age" : "<Some number>",
"fathername" : "<Some name>",
"gender" : "<M or F or O>",
"state" : "<Some state>",
"district" : "<Some district>"
}
These requests take some time to process (~7 min), since we download the file each time and run OCR on it.
- We also have a UI through which you can enter the above information and a JSON will be returned in the console window of your browser. Visit this link to check that out.
A sample response from the API will look like this:
{
"<EPIC NO>": {
"info": {
"age": <number>,
"house_no": "<number>",
"gender": "<M or F or O>",
"name": "<name>",
"father/husband": [
"<name>",
"<F or H>"
],
"uniqueid": "<EPIC NO>"
},
"children": [<List of names>],
"spouse": "<Name>",
"parents": [<List of names>],
"same": []
}
}
The keys returned in this JSON are self-explanatory.
We can take requests for Tamil Nadu and NCT of Delhi currently. Automation scripts for Uttar Pradesh and West Bengal have been written, but have not been implemented in the API.
- We have not used any external API's for finding these family trees, and used only open-source software to build this app.
- Our captcha solver can work for multilingual text too, which makes it a robust solver for many situations.
- OCR accuracy during conversion of PDFs to text has been improved using special mathematical algorithms created from scratch.
- Selenium (for automation)
- AI4Bharat Indic-Transliteration (translating between regional languages)
- Resnet Bi-LSTM Attention (captcha text detection)
- Tessaract OCR (captcha text recognition)