Skip to main content

🖼️ An image select component for Streamlit

Project description

streamlit-image-select 🖼️

Badge

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!


🏃 Try out the demo app 🏃


Installation

pip install streamlit-image-select

Usage

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

See the demo app for a detailed guide!

Development

Note: 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-image-select.git
cd streamlit-image-select

Install the Python dependencies:

poetry install --dev

And install the frontend dependencies:

cd streamlit_image_select/frontend
npm install

Making changes

To make changes, first go to streamlit_image_select/__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_image_select/frontend
npm start

This starts the frontend code on port 3001.

Open another terminal and run:

poetry shell
streamlit run demo.py

This starts the demo app. Now you can make changes to the Python or Javascript code in streamlit_image_select and the demo app should update automatically!

Publishing on PyPI

Switch the variable _RELEASE in streamlit_image_select/__init__.py to True. Increment the version number in pyproject.toml.

Build the frontend code with:

cd streamlit_image_select/frontend
npm run build

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

cd ..
poetry build
poetry publish

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

streamlit-image-select-0.1.4.tar.gz (694.8 kB view details)

Uploaded Source

Built Distribution

streamlit_image_select-0.1.4-py3-none-any.whl (705.2 kB view details)

Uploaded Python 3

File details

Details for the file streamlit-image-select-0.1.4.tar.gz.

File metadata

  • Download URL: streamlit-image-select-0.1.4.tar.gz
  • Upload date:
  • Size: 694.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.15 CPython/3.9.12 Darwin/21.6.0

File hashes

Hashes for streamlit-image-select-0.1.4.tar.gz
Algorithm Hash digest
SHA256 6d7d16fe763ac69bef6e1955f71e1c4356c6444c3b46f5d427f44584a75dcae3
MD5 36c5d8e67f3f29df80d709d49f9945a5
BLAKE2b-256 ed9f2646ac72dcc96bbd235fbe04c2432a74a79f64f278e7331c44b36d277c93

See more details on using hashes here.

File details

Details for the file streamlit_image_select-0.1.4-py3-none-any.whl.

File metadata

File hashes

Hashes for streamlit_image_select-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 9a7693cfbc1be7448e81abff8b9c34535b2ca8788d942739095c4252436cb95b
MD5 63b736aced1b79460e5dfd4f357655cc
BLAKE2b-256 14cae4e8e77e94ee0314c7ab77203f480932c4e27d9fcc2e4d0773ceb7dbfdac

See more details on using hashes here.

Supported by

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