Skip to main content

A simple tool to extract data from PDFs and images using Google's gemini-2.0-flash-001 model.

Project description

Gemini Data Extractor

This tool is a prof-of-concept for extracting data from PDFs and images, using the gemini-2.0-flash-001 LLM from Google. This model attracted a lot of attention lately due to its good performances ad affordable API prices.

It uses Google's GenAI library to interact with the model and extract data from a given document using your prompt. The extracted date is returned in JSON format.

Installation

You can install the tool using pip:

pip install gemini-data-extractor

Usage

You can use the tool by running the following command (see also "Authentication" below):

gemini-data-extractor --path path/to/your/file.pdf --prompt-text "Your prompt here"

The tool will return the extracted data in JSON format to the standard output. In case of a long prompt, you can save it to a file and pass the path to the file using the --prompt-file argument:

gemini-data-extractor --path path/to/your/file.png --prompt-file path/to/your/prompt.txt

Authentication

In order to use the gemini API you need to authenticate either using a gemini studio API key or via the Google Cloud SDK. You can obtain a key from Google AI Studio. You can then authenticate using the --api-key argument or setting the GEMINI_API_KEY environment variable:

gemini-data-extractor --path path/to/your/file.pdf --prompt "Your prompt here" --api-key your-api-key

or

export GEMINI_API_KEY=your-api-key
gemini-data-extractor --path path/to/your/file.pdf --prompt "Your prompt here"

Alternatively, if you have a working Google Cloud Account and the Google Cloud SDK installed, you can authenticate using the gcloud command:

gcloud auth application-default login

Then you can use the tool with the options --project-id and --location (or by setting the GCP_PROJECT_ID and GCP_LOCATION environment variables):

gemini-data-extractor --path path/to/your/file.pdf --prompt "Your prompt here" --project-id your-project-id --location your-location

or

export GCP_PROJECT_ID=your-project-id
export GCP_LOCATION=your-location
gemini-data-extractor --path path/to/your/file.pdf --prompt "Your prompt here"

License

This tool is licensed under the MIT license. You can find more information in the LICENSE file.

Disclaimer

Gemini is a trademark of Google LLC. This project is not affiliated with Google LLC. The tool uses the GenAI library to interact with the gemini-2.0-flash-001 LLM from Google. The tool is provided as-is and is not officially supported by Google LLC. Use it at your own risk.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gemini_data_extractor-0.1.1.tar.gz (35.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gemini_data_extractor-0.1.1-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file gemini_data_extractor-0.1.1.tar.gz.

File metadata

File hashes

Hashes for gemini_data_extractor-0.1.1.tar.gz
Algorithm Hash digest
SHA256 a2682833d1e325093bf22da33f0e7cf41d8dd37b987fc22e9a46fe7071cde582
MD5 4dd242cde6bb40c18732d081ff812aec
BLAKE2b-256 ca6f12e89bac329d15516e378ffce33b5cec562f39c85cd263f9b2fe4ffc5162

See more details on using hashes here.

File details

Details for the file gemini_data_extractor-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for gemini_data_extractor-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 88408819aba68dcf67e3a146e2c3865dd123a62e3a10daa687bdfa190f6ebfcf
MD5 c96459d438f7a8b495b4afa8dd07d962
BLAKE2b-256 f0bc62a303fea78cbe6b702394fcf5dde32ad2c51039409fd5f41c1a7d2b0b46

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page