Skip to main content

streamlit-avatar

Component to display avatar icon in Streamlit

alt text

Installation instructions

pip install streamlit-avatar

Usage instructions

Simple Usage

import streamlit as st
from streamlit_avatar import avatar

result = avatar(
    [
        {
            "url": "https://picsum.photos/id/237/300/300",
            "size": 40,
            "title": "Sam",
            "caption": "hello",
            "key": "avatar1",
        },
        {
            "url": "https://picsum.photos/id/238/300/300",
            "size": 40,
            "title": "Bob",
            "caption": "happy",
            "key": "avatar2",
        },
        {
            "url": "https://picsum.photos/id/23/300/300",
            "size": 40,
            "title": "Rick",
            "caption": "Bye",
            "key": "avatar3",
        },
    ]
)
st.write(result)

""" Return
{
"title":"Sam"
"cption":"hello"
"key":"avatar1"
}
"""

Using Base64

import streamlit as st
from streamlit_avatar import avatar
import base64

def get_image_base64(image_path):
    with open(image_path, "rb") as image_file:
        return base64.b64encode(image_file.read()).decode("utf-8")

image_path = "assets/image.png"
image_base64 = get_image_base64(image_path)
image_url = f"data:image/png;base64,{image_base64}"

result = avatar(
    [
        {
            "url": image_url,
            "size": 40,
            "title": "Sam",
            "caption": "hello",
            "key": "avatar1",
        }
    ]
)
st.write(result)

Metadata

Release files for streamlit-avatar 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for streamlit-avatar 0.1.3
File Size Uploaded
streamlit_avatar-0.1.3.tar.gz 402.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for streamlit-avatar 0.1.3
File Interpreter ABI Platform
streamlit_avatar-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 1.2 MB

Release files / streamlit_avatar-0.1.3.tar.gz

Download URL streamlit_avatar-0.1.3.tar.gz
Size 402.1 kB
Tags Source
SHA-256 checksum
How to use checksums
023893bd80db5a923d397fc64d27c7a972107da4f0bea0feb99a32f9363f2691
BLAKE2b-256 checksum
How to use checksums
b7a209c6046b1934f79ce2c6d767f3c7760ce632685498e67af455a2ae962d4a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.12.3

Release files / streamlit_avatar-0.1.3-py3-none-any.whl

Download URL streamlit_avatar-0.1.3-py3-none-any.whl
Size 779.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
873e6f0022635eda29d6b76e570adcbc095d8e6d23f18dd1e288720b4736364d
BLAKE2b-256 checksum
How to use checksums
cf774b82378aa4caf7ef7701841b25a5406b3a3bb6171c8b9eee540553843b7f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page