Skip to main content

ezMM: Mini-Suite for Easy Multimodal Data Processing

This lightweight Python package aims to streamline and simplify the processing of multimodal data. The core philosophy of ezMM is to treat any data (whether strings, images, audios, tables, etc.) as a multimodal sequence.

Usage

Core is the MultimodalSequence class. Here is an example:

from ezmm import MultimodalSequence, Image

img1 = Image("in/roses.jpg")
img2 = Image("in/garden.jpg")

seq = MultimodalSequence("The image", img1, "shows two beautiful roses while",
                         img2, "shows a nice garden with many flowers.")

seq comprehensively aggregates the different modalities into one handy object. It also offers some useful features:

MultimodalSequence is stringifyable

print(seq)

will return

The image <image:1> shows two beautiful roses while <image:2> shows a nice garden with many flowers.

That is, non-string items in the MultimodalSequence get replaced by their unique reference when turned into strings.

MultimodalSequence understands references

Conversely, you can do

seq2 = MultimodalSequence("The image <image:1> shows two beautiful roses while <image:2> shows a nice garden with many flowers.")

which obeys seq == seq2. That is, MultimodalSequence resolves references within the input string and loads the corresponding items under the hood.

Access MultimodalSequence like a list

You can apply list comprehension to seq. For example, seq[1] == img.

Easy modality checks

You can check for specific modalities like images quickly, e.g., with seq.has_images().

Get the text and manipulate the sequence

seq.text returns all text parts (without items) as a single string. You can manipulate a MultimodalSequence like a list via append(), extend(), insert(), remove(), pop(), seq[i] = ..., del seq[i], + and +=. Nested sequences are always flattened automatically, so a MultimodalSequence never contains another one.

Item Types

Class Reference For
Image <image:1> Images (JPEG, PNG, AVIF, ...)
Video <video:1> Videos (MP4, ...)
Audio <audio:1> Audio-only files (MP3, WAV, FLAC, OGG, M4A, ...)
File <file:1> Any other file (PDF, Excel sheets, archives, ...)

All items can be created from a file path or from binary data, e.g., Audio(binary_data=data, mime_type="audio/mpeg"). Files larger than 100 MB are rejected with a FileTooLargeError; change the limit with set_max_file_size(n_bytes) (or None for no limit) or the EZMM_MAX_FILE_SIZE environment variable.

Item Registry

ezMM keeps track of all items in a registry (an SQLite DB plus media files) located at temp/ or at the path specified by the EZMM environment variable (or set_ezmm_path()).

  • Deduplication: Identical files (same kind and byte-identical content, incl. embedded metadata) collapse to the same item and reference. Each item keeps all its source URLs (item.source_urls). To find an item by URL, use item_registry.get_by_source_url(url).
  • Cleanup: python -m ezmm dedup [--dry-run] removes duplicates from existing registries. References to removed duplicates keep resolving to the remaining item.
  • Migration: Registries created with ezMM < 0.6 are migrated automatically on first use (a backup item_registry.v1.bak.db is kept). Older ezMM versions cannot read migrated registries.

Web UI

Install with pip install ezmm[ui] and run

python -m ezmm ui [--path REGISTRY_PATH] [--port 7878]

to browse all items of the registry (and sequences rendered via seq.render()) at http://localhost:7878.

Feature Overview

  • ✅ Image support
  • ✅ Video support
  • ✅ Audio support
  • ✅ Support for any other file type
  • ✅ Saving and organizing media in a database along with their origin URLs
  • ✅ Rendering MultimodalSequence and browsing the registry in a web UI
  • ✅ Duplication management: Identify and re-use duplicates

Metadata

Release files for ezMM 0.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ezMM 0.6.0
File Size Uploaded
ezmm-0.6.0.tar.gz 47.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ezMM 0.6.0
File Interpreter ABI Platform
ezmm-0.6.0-py3-none-any.whl Python 3 none any Details

Total release size: 94.2 kB

Release files / ezmm-0.6.0.tar.gz

Download URL ezmm-0.6.0.tar.gz
Size 47.1 kB
Tags Source
SHA-256 checksum
How to use checksums
d8c30bd510d836a0b921e9a4515c2b52cd600d85bd02efae23e53b68a16862a7
BLAKE2b-256 checksum
How to use checksums
525ac83fdc4aa73698d67379bd1595f431414c0314a27a73975ef9c5029b2b23
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.13

Release files / ezmm-0.6.0-py3-none-any.whl

Download URL ezmm-0.6.0-py3-none-any.whl
Size 47.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f01e46625f6fead197328249a67dd99bae065511bfc027a757f90a7036c2c44f
BLAKE2b-256 checksum
How to use checksums
14c942a69c8a2e0d62eeb02b252a15c30fc34e8aa9d9d6f12e0a45a165f3409e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.13

Release history Release notifications | RSS feed

0.7.8

2 release files

0.7.7

2 release files

0.7.6

2 release files

0.7.5

2 release files

0.7.4

2 release files

0.7.3

2 release files

0.7.2

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.1

2 release files

This release

0.6.0 This release

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.9

2 release files

0.3.8

2 release files

0.3.7

2 release files

0.3.6

2 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page