This project has been archived by its maintainers, and is no longer receiving any updates.
Tools for VLM-1
vlm-tools provides a convenient set of tools to interact with the VLM-1 API.
Installation
The vlm-tools python package is available on PyPI. You can install it using pip:
pip install vlm-tools
Optionally, if you want to install the torch extra dependencies, you can do so by installing the package with the torch extra:
pip install vlm-tools[torch]
Authentication
The VLM-1 API requires an API key to authenticate requests. You can obtain an API key by signing up on the waitlist. Once you have an API key, you can set it in the environment variable VLM_API_KEY:
export VLM_API_KEY='...'
Usage
Image -> JSON
The python client needs to be configured with your personal API key before you can use it. You can set the API key in the environment variable VLM_API_KEY as described above or pass it to the client constructor.
from vlm_tools.api import vlm
>>> image = Image.open(...)
>>> response_json = vlm(image, domain="document.presentation")
>>> response_json
{
"description": "...",
"title": "Differentiated Operating Model",
"page_number": 7,
"plots": [
...
],
"tables": null,
"others": [
...
]
}
Streaming Image -> JSON
You can also stream the image to the API using the stream method. This is useful when you want to stream images to our API sequentially, and one-by-one. We provide some helper functions to help you with sampling unique-images (content-based sampler) from a video stream.
from vlm_tools.video import VideoReader, VideoItertools
>>> itertools = VideoItertools()
>>> video = VideoReader("path/to/video.mp4")
>>> for img in itertools.islice(video, similarity_threshold=0.9)
... response_json = vlm(img, domain="document.presentation")
Requirements
- Python 3.10+
We currently support Python 3.10+ on Linux and macOS. If you have any questions or issues, please open an issue.
Metadata
Release files for vlm-tools 0.2.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| vlm_tools-0.2.3-py3-none-any.whl | Python 3 | none | any | Details for vlm_tools-0.2.3-py3-none-any.whl |
Release files / vlm_tools-0.2.3-py3-none-any.whl
| Download URL | vlm_tools-0.2.3-py3-none-any.whl |
|---|---|
| Size | 11.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
17524cb0f2c76ace3c3f09eb85a73ddbae9673ba51e0aa0ea97a248126efe2d1
|
|
BLAKE2b-256 checksum How to use checksums |
51bba97f7cffa5ca803037e68b160801534cd3471c67906f78c79173c706fbf5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.9
|
Security for vlm-tools 0.2.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.