🖼️ An image select component for Streamlit
Project description
streamlit-image-select 🖼️
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for streamlit-image-select-0.1.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6e8f7938481b030f1cd1b17c4c4b354db69dc46cac818960d8fab66ab8c5d10e |
|
MD5 | df47ef89ca0469eb031c3e52f0f8e843 |
|
BLAKE2b-256 | ae03fac025fec0825dabd383bc145120622ddfea9ce1a55b0efed49dc57c3169 |
Hashes for streamlit_image_select-0.1.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2390cb22ae21180d9ef78fdea1bde694a41856e146b7ec8a974f136966a3b35a |
|
MD5 | 4c22cc1aedb560fe4fa230ba4b4e40ac |
|
BLAKE2b-256 | aff137e1b6085a053056a321aac5ba0cdca6e5add1b53726509f939ed80890a8 |