Streamlit Multimodal Chat Input
A Streamlit component that enables a rich multimodal chat interface, allowing users to input text and upload images within Streamlit applications. Demo video at Streamlit Community Forum.
Features
- Text Input: Users can type in their messages.
- Image Upload: Supports uploading images, enhancing the chat with a visual element.
- Clipboard Paste: Enables pasting images directly from the clipboard.
- Responsive Design: Adjusts to the width of the Streamlit container.
- Disabled State: Can be set to a disabled state, making the input and button non-interactive and visually distinct.
Installation Instructions
To install the component, run the following command:
pip install st-multimodal-chatinput
Usage instructions
import streamlit as st
from st_multimodal_chatinput import multimodal_chatinput
chatinput = multimodal_chatinput()
uploaded_files = chatinput["uploadedFiles"] ##list of ALL uploaded files (including images) along with type, name, and content.
uploaded_images = chatinput["uploadedImages"] ## list of base 64 encoding of uploaded images
text = chatinput["textInput"] ##submitted text
for file in uploaded_files:
filename = file["name"]
filetype = file["type"] ## MIME type of the uploaded file
filecontent = file["content"] ## base 64 encoding of the uploaded file
Common MIME types
| File Extension | MIME Type |
|---|---|
| application/pdf | |
| .doc | application/msword |
| .csv | text/csv |
You can find other common types here.
Contributing
Pull requests for some of the to-dos are more than welcome.
Release files for st-multimodal-chatinput 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| st-multimodal-chatinput-0.2.1.tar.gz | 445.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| st_multimodal_chatinput-0.2.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 894.1 kB
Release files / st-multimodal-chatinput-0.2.1.tar.gz
| Download URL | st-multimodal-chatinput-0.2.1.tar.gz |
|---|---|
| Size | 445.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fa8e02568e2bfd645ae3479e02933ba67a2b0db49063064ddb988cb9c2c697a4
|
|
BLAKE2b-256 checksum How to use checksums |
4734c4fbd76bbd006855c8193acad5dd874450dd2c41cd7d21f5955703dc555b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.6
|
Release files / st_multimodal_chatinput-0.2.1-py3-none-any.whl
| Download URL | st_multimodal_chatinput-0.2.1-py3-none-any.whl |
|---|---|
| Size | 448.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d997a6f7d39d4aaadd4944f5ef853c7af6b20c7a7a8f601dbba3fa76c37a3fb4
|
|
BLAKE2b-256 checksum How to use checksums |
0b1282e584e6a8042ad32c9a6313e56f0c1c0f01c9f01f29e4eb9c2640a74978
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.6
|