This kit include a series of Notebooks that demonstrates various methods for extracting text from documents in different input formats. including Markdown, PDF, CSV, RTF, DOCX, XLS, HTML
Important: With this option some funcionalities requires to install some pakges directly in your system
- pandoc (for local rtf files loading)
- tesseract-ocr (for PDF ocr and table extraction)
- poppler-utils (for PDF ocr and table extraction)
- Clone repo.
git clone https://github.sambanovasystems.com/SambaNova/ai-starter-kit.git
2.1 Install requirements: It is recommended to use virtualenv or conda environment for installation.
cd ai-starter-kit
python3 -m venv data_extract_env
source data_extract_env/bin/activate
cd data_extraction
pip install -r requirements.txt
2.2 Install requirements for paddle utility: ,It is recommended to use virtualenv or conda environment for installation.
Use this in case you want to use Paddle OCR recipe for PDF OCR and table extraction you shold use the requirementsPaddle file instead
cd ai-starter-kit
python3 -m venv data_extract_env
source data_extract_env/bin/activate
cd data_extraction
pip install -r requirementsPaddle.txt
- Some text extraction examples use Unstructured lib. Please register at Unstructured.io to get a free API Key. then create an enviroment file to store the APIkey and URL provided.
echo 'UNSTRUCTURED_API_KEY="your_API_key_here"\nUNSTRUCTURED_API_KEY="your_API_url_here"' > export.env
With this option all funcionalities and notebook are ready to use
You need to have the Docker engine installed Docker installation
- Clone repo.
git clone https://github.sambanovasystems.com/SambaNova/ai-starter-kit.git
- Some text extraction examples use Unstructured lib. Please register at Unstructured.io to get a free API Key. then create an enviroment file to store the APIkey and URL provided.
echo 'UNSTRUCTURED_API_KEY="your_API_key_here"\nUNSTRUCTURED_API_KEY="your_API_url_here"' > export.env
3.1 Run data extraction docker container
sudo docker-compose up data_extraction_service
3.2 Run data extraction docker container for Paddle utility 3.1 Run data extraction docker container
sudo docker-compose up data_extraction_service
3.2 Run data extraction docker container for Paddle utility
Use this in case you want to use Paddle OCR recipe for PDF OCR and table extraction you shold use the startPaddle script instead
sudo docker-compose up data_extraction_paddle_service
You will find several data extraction recipes and pipelines in the notebooks folder as follows:
- csv_extraction.ipynb: This notebook provides examples of text extraction from CSV files using different packages. Depending on your specific use case, some packages may perform better than others.
- xls_extraction.ipynb: This notebook provides examples of text extraction from files in different input format using Unstructured lib. Section 2 includes two loading examples first one using unstructured API and the other using local unstructured loader
- docx_extraction.ipynb: This notebook provides examples of text extraction from files in different input format using Unstructured lib. Section 3 includes two loading examples first one using unstructured API and the other using local unstructured loader
- rtf_extraction.ipynb: This notebook provides examples of text extraction from files in different input format using Unstructured lib. Section 4 includes two loading examples first one using unstructured API and the other using local unstructured loader
- markdown_extraction.ipynb: This notebook provides examples of text extraction from files in different input format using Unstructured lib. Section 5 includes two loading examples first one using unstructured API and the other using local unstructured loader
- web_extraction.ipynb: This notebook provides examples of text extraction from files in different input format using Unstructured lib. Section 6 includes two loading examples first one using unstructured API and the other using local unstructured loader
-
pdf_extraction.ipynb: This notebook provides examples of text extraction from PDF documents using different packages including different OCR and non-OCR packages. Depending on your specific use case, some packages may perform better than others.
-
retrieval_from_pdf_tables.ipynb: This notebook provides an example of a simple RAG retiever and an example of a multivector RAG retriever for pdf with tables retrieval. For SambaNova model endpoint usage refer to the ai-starter-kit docs
-
qa_qc_util.ipynb: This notebook offers a simple utility for visualizing text boxes extracted using the Fitz package. This visualization can be particularly helpful when dealing with complex multi-column PDF documents, and in the debugging process.