🖼️ An image select component for Streamlit

Overview

streamlit-image-select 🖼️

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!


🏃 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:

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_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. 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_image_select/frontend
npm run build

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

cd ../..
poetry build
poetry publish
You might also like...

Piccloud is a full-stack (Angular & Spring Boot) online image clipboard that lets you share images over the internet by generating a unique URL. Others can access the image via this URL.

Piccloud Piccloud is a full-stack application built with Angular & Spring Boot. It is an online image clipboard that lets you share images over the in

Dec 15, 2022

Cloudinary Image component for Next.js

Cloudinary Image component for Next.js

Cloudinary Next.js Component Get the best of Cloudinary in Next.js with the CldImage component! 🚨 EXPERIMENTAL: while this should be working pretty w

Dec 20, 2022

This simple project, show how work with async Fetch, function component and class component

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

Feb 17, 2022

dynamic-component-app is an angular application for dynamic component template creation

MyApp This project was generated with Angular CLI version 14.1.0. Development server Run ng serve for a dev server. Navigate to http://localhost:4200/

Aug 26, 2022

Bootstrap5-tags - Replace select[multiple] with nices badges

Bootstrap5-tags - Replace select[multiple] with nices badges

Tags for Bootstrap 4/5 How to use An ES6 native replacement for select using standards Bootstrap 5 (and 4) styles. No additional CSS needed! Supports

Jan 9, 2023

Select creates a dropdown list of items with the selected item in closed view.

Select creates a dropdown list of items with the selected item in closed view.

Native Base Select 🔽 This module includes a customizable multi-select and a single select component for Native Base. The package is both Android and

Dec 25, 2022

Annotation tools for the web. Select text, images, or (nearly) anything else, and add your notes.

Annotator Annotator is a JavaScript library for building annotation applications in browsers. It provides a set of interoperable tools for annotating

Dec 23, 2022

🛠 Highly customisable, minimalistic input x select field for React.

Insect 🛠 Highly customisable, minimalistic input x select field for React. ⚡️ Features Tiny size (~4kb Gzip) 100% responsive. Highly customisable. Su

Oct 29, 2022

A custom select dropdown. This is something that is not too difficult to make.

Custom-Dropdown-JS A custom select dropdown using basic JS fucntionality. This is something that is not too difficult to make. But it shows that you h

Mar 26, 2022
Comments
  • Allow inital selected image to be specified

    Allow inital selected image to be specified

    Thanks for making this super useful component.

    I was wondering if it might be possible to specify the image that is selected when the app first loads. Perhaps this could default to None.

    The regular streamlit select box makes use of a argument called index to perform this

    opened by shimwell 2
  • Make images scrollable

    Make images scrollable

    Hi, thank you for this!

    I have a little request, in case of a lot of images being passed to image_select, Is it possible to make them scrollable to the right or left? Right now everything seems to be listed at once

    Thank you

    opened by darwinharianto 0
  • Fix caption color of first render with dark theme

    Fix caption color of first render with dark theme

    Move dark theme handling code lower, to affect caption variable. Otherwise on the first render of the app with dark theme, the caption color is almost not visible as it uses the light theme color.

    opened by chrieke 0
  • Select multiple images

    Select multiple images

    Being able to select multiple images would increase the applicability of streamlit-image-select. An example use would be to load up numerous images on a page, select a category from a dropdown menu (corresponding to a label), and then select all images matching the label. I'd then use a submit/form button, or other action to generate output data. This data, related to the image filename or index, would then be used for other tasks.

    Again, great work!

    opened by rnobalr 1
Owner
Johannes Rieke
Product manager @streamlit
Johannes Rieke
Hemsida för personer i Sverige som kan och vill erbjuda boende till människor på flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

null 4 May 3, 2022
Kurs-repo för kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

null 14 Jan 3, 2023
Hashmat Noorani 4 Mar 21, 2023
VanillaSelectBox - A dropdown menu with lots of features that takes a select tag and transforms it into a single or multi-select menu with 1 or 2 levels

vanillaSelectBox v1.0.0 vanillaSelectBox : v1.00 : Adding a package.json file New : Possibility to change the dropdown tree and change the remote sear

philippe MEYER 103 Dec 16, 2022
optimize image & upload file to cloud as image bed with tiny image automic.

Rush! 图片压缩 & 直传图床工具 这是一个兴趣使然的项目, 希望 Rush! 能让这个世界的网络资源浪费减少一点点 下载 Downloads 获取最新发行版 功能 Features 拖拽批量压缩图片, 支持格式 jpg/png/gif Drop to optimize, jpg/png/gif

{ Chao } 3 Nov 12, 2022
🖼️ Image proxy for Next.js. Makes it possible to use dynamic domains in next/image component.

Next.js Image Proxy Image proxy for Next.js. Makes it possible to use dynamic domains in next/image component. ❔ Motivation This library makes it poss

Blazity 30 Dec 1, 2022
Animated Select Component (React)

Spring Chain We built a custom select component with a menu with animations and beautiful gradients and a glassy style, is called "Spring Chain" becau

Cecilia Benitez 7 Feb 6, 2022
A Javascript library that discourages and prevents image theft/download by preventing client ability to retrieve the image.

ProtectImage.js ProtectImage.js is a Javascript library that helps prevent image theft by disabling traditional user interactions to download/copy ima

null 4 Aug 18, 2022
Simple JavaScript Library to add parallax image to background-image

Backpax Simple JavaScript Library to add parallax image to background-image Install $ npm install backpax --save Demo Demo page is here Usage If you

appleple 13 Oct 12, 2022