Parser for all.
Project description
🌊 AnyParser
AnyParser provides an API to accurately extract unstructured data (e.g., PDFs, images, charts) into a structured format.
:seedling: Set up your AnyParser API key
To get started, generate your API key from the Sandbox Account Page. Each account comes with 100 free pages.
⚠️ Note: The free API is limited to 10 pages/call.
For more information or to inquire about larger usage plans, feel free to contact us at info@cambioml.com.
To set up your API key (CAMBIO_API_KEY
), follow these steps:
- Create a
.env
file in the root directory of your project. - Add the following line to the
.env
file:
CAMBIO_API_KEY=0cam************************
:computer: Installation
1. Set Up a New Conda Environment and Install AnyParser
First, create and activate a new Conda environment, then install AnyParser:
conda create -n any-parse python=3.10 -y
conda activate any-parse
pip3 install any-parser
2. Create an AnyParser Instance Using Your API Key
Use your API key to create an instance of AnyParser. Make sure you’ve set up your .env file to store your API key securely:
import os
from dotenv import load_dotenv
from any_parser import AnyParser
# Load environment variables
load_dotenv(override=True)
# Get the API key from the environment
example_apikey = os.getenv("CAMBIO_API_KEY")
# Create an AnyParser instance
ap = AnyParser(api_key=example_apikey)
3. Run Synchronous Extraction
To extract data synchronously and receive immediate results:
# Extract content from the file and get the markdown output along with processing time
markdown, total_time = ap.parse(file_path="./data/test.pdf")
4. Run Asynchronous Extraction
For asynchronous extraction, send the file for processing and fetch results later:
# Send the file to begin asynchronous extraction
file_id = ap.async_parse(file_path="./data/test.pdf")
# Fetch the extracted content using the file ID
markdown = ap.async_fetch(file_id=file_id)
:scroll: Examples
Check out these examples to see how you can utilize AnyParser to extract text, numbers, and symbols in fewer than 10 lines of code!
Extract all text and layout from PDF into Markdown Format
Are you an AI engineer looking to accurately extract both the text and layout (e.g., table of contents or Markdown headers hierarchy) from a PDF? Check out this 3-minute notebook demo.
Extract a Table from an Image into Markdown Format
Are you a financial analyst needing to accurately extract numbers from a table within an image? Explore this 3-minute notebook example.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file any_parser-0.0.19.tar.gz
.
File metadata
- Download URL: any_parser-0.0.19.tar.gz
- Upload date:
- Size: 8.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.10.14 Darwin/24.1.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a014bcb2f51f53779219da64145e57aac2f31abcbf984a70d80af0b268c5c34c |
|
MD5 | 7aebee685471697948910dcaea86d88e |
|
BLAKE2b-256 | 7be1f2abfaa113093edcaae51569d39c40d0fd8a29a28a5618a37b92e0433dec |
File details
Details for the file any_parser-0.0.19-py3-none-any.whl
.
File metadata
- Download URL: any_parser-0.0.19-py3-none-any.whl
- Upload date:
- Size: 9.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.10.14 Darwin/24.1.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1825b9cd5bca609f80d5e505fc4aa6d6ae07ef8dd4a025915e9c64f5d81dcbc5 |
|
MD5 | 75f9d33de6bed0311f15c1fddeda5822 |
|
BLAKE2b-256 | 8d2c00e32f6a3fca5b9fe18d824fc48444a2a97b3c5c6b3ee47bfc8c2e24294f |