streamlit-avatar
Component to display avatar icon in Streamlit
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)
| File | Size | Uploaded | |
|---|---|---|---|
| streamlit_avatar-0.1.3.tar.gz | 402.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| 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
|