Skip to main content

streamlit-dash

PyPI

An image select component for Streamlit.

This custom component works just like st.selectbox but with images. It's a great option if you want to let the user select an example image, e.g. for a computer vision app!

Installation

pip install streamlit-dash

Usage

from streamlit_dash import image_select
img = image_select("Label", ["image1.png", "image2.png", "image3.png"])
st.write(img)

Development

Warning You only need to run these steps if you want to change this component or contribute to its development!

Setup

First, clone the repository:

git clone https://github.com/jrieke/streamlit-dash.git
cd streamlit-dash

Install the Python dependencies:

poetry install --dev

And install the frontend dependencies:

cd streamlit_dash/frontend
npm install

Making changes

To make changes, first go to streamlit_dash/__init__.py and make sure the variable _RELEASE is set to False. This will make the component use the local version of the frontend code, and not the built project.

Then, start one terminal and run:

cd streamlit_dash/frontend
npm start

This starts the frontend code on port 3001.

Open another terminal and run:

cp demo/streamlit_app.py .
poetry shell
streamlit run streamlit_app.py

This copies the demo app to the root dir (so you have something to work with and see your changes!) and then starts it. Now you can make changes to the Python or Javascript code in streamlit_dash and the demo app should update automatically!

If nothing updates, make sure the variable _RELEASE in streamlit_dash/__init__.py is set to False.

Publishing on PyPI

Switch the variable _RELEASE in streamlit_dash/__init__.py to True. Increment the version number in pyproject.toml. Make sure the copy of the demo app in the root dir is deleted or merged back into the demo app in demo/streamlit_app.py.

Build the frontend code with:

cd streamlit_dash/frontend
npm run build

After this has finished, build and upload the package to PyPI:

cd ../..
poetry build
poetry publish

Changelog

0.6.0 (March 28, 2023)

  • Removed st.experimental_memo, which is deprecated.
  • Changed minimum version of Streamlit to 1.19.

0.5.1 (November 20, 2022)

  • Hotfix, forgot to switch the RELEASE variable back to True 😉

0.5.0 (November 20, 2022)

  • Added return_value parameter to be able to get the index of the selected image.
  • Improved error messages.

0.4.0 (November 20, 2022)

  • Added index parameter to set the initially selected image.
  • Improved input arg checks.

0.3.0 (November 13, 2022)

  • Added use_container_width parameter to customize the width of the component.
  • Made key and use_container_width parameters keyword-only.
  • Refactored CSS classes.

Metadata

Release files for streamlit-select 0.3

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-select 0.3
File Size Uploaded
streamlit_select-0.3.tar.gz 699.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for streamlit-select 0.3
File Interpreter ABI Platform
streamlit_select-0.3-py3-none-any.whl Python 3 none any Details

Total release size: 1.4 MB

Release files / streamlit_select-0.3.tar.gz

Download URL streamlit_select-0.3.tar.gz
Size 699.4 kB
Tags Source
SHA-256 checksum
How to use checksums
016adfd39f00616940eb62b6810f5a5acaba2da8a47f377ccac8139b6b989b9f
BLAKE2b-256 checksum
How to use checksums
620ddf6025abeaf345d871ea2bd0fd39f03ebac496e3cb0f90a051ef53e1bd68
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.6

Release files / streamlit_select-0.3-py3-none-any.whl

Download URL streamlit_select-0.3-py3-none-any.whl
Size 710.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
64f46719ac9d2273df148fa34f75223ad2ba61f3657306d0925c8ba6b25760f3
BLAKE2b-256 checksum
How to use checksums
623e0f78cf634e6cf60b8adcc012ba0b487e7a14f4218a39d3daf506349ad371
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.6

Release history Release notifications | RSS feed

This release

0.3 This release

2 release files

0.2

2 release files

0.1

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