Skip to main content

Streamlit multimodal chat input component with text, image, and voice support

Project description

Streamlit Multimodal Chat Input

A multimodal chat input component for Streamlit that supports text input, image upload, and voice input.

Features

  • 📝 Text Input: Same usability as st.chat_input
  • 🖼️ Image File Upload: Supports jpg, png, gif, webp
  • 🎤 Voice Input: Web Speech API / OpenAI Whisper API support
  • 🎨 Streamlit Standard Theme: Fully compatible design
  • 🔄 Drag & Drop: File drag and drop support
  • ⌨️ Ctrl+V: Paste images from clipboard
  • ⚙️ Customizable: Rich configuration options

Installation

pip install st-chat-input-multimodal

Basic Usage

import streamlit as st
from st_chat_input_multimodal import multimodal_chat_input

# Basic usage
result = multimodal_chat_input()

if result:
    # Display text
    if result['text']:
        st.write(f"Text: {result['text']}")
    
    # Display uploaded files
    if result['files']:
        for file in result['files']:
            import base64
            base64_data = file['data'].split(',')[1]
            image_bytes = base64.b64decode(base64_data)
            st.image(image_bytes, caption=file['name'])
    
    # Display voice input metadata
    if result.get('audio_metadata'):
        st.write(f"Voice input used: {result['audio_metadata']['used_voice_input']}")

Advanced Usage

Voice Input Features

# Enable voice input
result = multimodal_chat_input(
    enable_voice_input=True,
    voice_recognition_method="web_speech",  # or "openai_whisper"
    voice_language="ja-JP",
    max_recording_time=60
)

# Using OpenAI Whisper API
result = multimodal_chat_input(
    enable_voice_input=True,
    voice_recognition_method="openai_whisper",
    openai_api_key="sk-your-api-key",
    voice_language="ja-JP"
)

Custom Configuration

result = multimodal_chat_input(
    placeholder="Please enter your message...",
    max_chars=500,
    accepted_file_types=["jpg", "png", "gif", "webp"],
    max_file_size_mb=10,
    disabled=False,
    key="custom_chat_input"
)

License

MIT License

Author

tsuzukia21

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

st-chat-input-multimodal-1.0.0.tar.gz (131.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

st_chat_input_multimodal-1.0.0-py3-none-any.whl (131.9 kB view details)

Uploaded Python 3

File details

Details for the file st-chat-input-multimodal-1.0.0.tar.gz.

File metadata

  • Download URL: st-chat-input-multimodal-1.0.0.tar.gz
  • Upload date:
  • Size: 131.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.3

File hashes

Hashes for st-chat-input-multimodal-1.0.0.tar.gz
Algorithm Hash digest
SHA256 50b53252b35a7b18e5ee1d48dbf5232a6accf03745363c4f3c4e1cf7665e8723
MD5 c7dcd91e24d8f92cd1693e0adfe0f44a
BLAKE2b-256 ae6fdb9bf275cbf7f881fe5237247999c8be1f384f7e48926dc406dd3ffcc944

See more details on using hashes here.

File details

Details for the file st_chat_input_multimodal-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for st_chat_input_multimodal-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6a34e6b42d01e58ff10409e7bd781aab6a3779a2b8fbbca7376e3b558231ce3c
MD5 dd3005c97890dc2a42537f8d3ed724ce
BLAKE2b-256 07aa46ae507660789a2c97bc2f453d3bff00ad5934486fbd719769629f226b24

See more details on using hashes here.

Supported by

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