Skip to main content

Streamlit-Overlay 🖼️🖌️

👌 Simplify adding overlays to images in Streamlit

Installation

pip install streamlit-overlay

Quick Start

In your app.py insert the following lines of code.

from streamlit_overlay import overlay

images = ... # np.narray of shape (#frames, height, width, 3)
masks = ... # np.array of shape (#frames, height, width, 3)
overlay(images, masks, key="example_overlay")

Running your app via

streamlit run app.py

will then render a customizable video demo.

API

streamlit_overlay.overlay(images, masks=[], alpha=0.5, key=None, toggle_label="Display Overlay", fps=30, autoplay=False)

Creates an instance of the "overlay" component for use in a Streamlit app. It allows for the overlaying of masks on images, with customizable options for transparency, display controls, and playback settings.

Parameters

  • images: np.ndarray or List[Image]

    The images to display. This can be a single image or a sequence of images (for video). The shape should be (height, width, 3) for a single image or (num_frames, height, width, 3) for a sequence.

  • masks: np.ndarray or List[Image], optional

    The masks to overlay on the images. This should match the shape of the images parameter. If not provided, the function will only display the images.

  • alpha: float, optional

    The transparency level for the mask overlay. A value of 0 means the mask is fully transparent, while 1 means it is fully opaque.

  • key: str or None, optional

    An optional key that uniquely identifies this component. If this is None, and the component's arguments are changed, the component will be re-mounted in the Streamlit frontend and lose its current state.

  • toggle_label: str, optional

    The label for the toggle button that controls the visibility of the overlay.

  • fps: int, optional Frames per second for displaying a video.

  • autoplay: bool, optional

    Whether to automatically start playing the video upon loading. This setting is only relevant if images and masks represent a sequence of frames.

streamlit_overlay.heatmap_overlay(images, masks, colormap=cv2.COLORMAP_JET, toggle_label="Display Heatmap", *args, **kwargs)

Creates an instance of the "heatmap_overlay" component for overlaying heatmaps, e.g. of attribution maps, over images within a Streamlit app. This component processes the provided masks by applying a colormap, enhancing the visualization of data overlays.

Parameters

  • images: np.ndarray or List[Image]

    The images to display. This can be a single image or a sequence of images (for video). The shape should be (height, width, 3) for a single image or (num_frames, height, width, 3) for a sequence.

  • masks: np.ndarray or List[Image], optional

    The masks to overlay on the images. The shape should be (height, width) for a single mask or (num_frames, height, width) for a sequence. These masks will be processed using the specified colormap.

  • colormap: int, optional

    The OpenCV colormap identifier to use for applying color to the masks. This allows for a more vivid and informative visualization of the mask data.

  • toggle_label: str, optional

    The label for the toggle button that controls the visibility of the overlay.

Metadata

Release files for streamlit-overlay 0.0.1

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

Source distribution (sdist)

Source distribution for streamlit-overlay 0.0.1
File Size Uploaded Provenance Actions
streamlit_overlay-0.0.1.tar.gz 125.2 kB Without provenance Details for streamlit_overlay-0.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for streamlit-overlay 0.0.1
File Interpreter ABI Platform Actions
streamlit_overlay-0.0.1-py3-none-any.whl Python 3 none any Details for streamlit_overlay-0.0.1-py3-none-any.whl

Total release size: 249.7 kB

Release files / streamlit_overlay-0.0.1.tar.gz

Download URL streamlit_overlay-0.0.1.tar.gz
Size 125.2 kB
Tags Source
SHA-256 checksum
How to use checksums
d41c65e600943e41a04d3932b8f480332f0d243cbf7344a6218dcd4ab7c207a0
BLAKE2b-256 checksum
How to use checksums
d718d22be1e2c420614e2fc300dd53e2d643998f2d0fed1aa0ef97cfa338b233
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.8.19

Release files / streamlit_overlay-0.0.1-py3-none-any.whl

Download URL streamlit_overlay-0.0.1-py3-none-any.whl
Size 124.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
86906386b74a88728034b8a81e6833def9a177cc379f0a28b1fc386201b3ab99
BLAKE2b-256 checksum
How to use checksums
799fc905329c41d99f52c27447034f414cc2a318d5ee3debaada0a4c62b812d5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.8.19

Security for streamlit-overlay 0.0.1

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.

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files No provenance

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