Component to display avatar icon in Streamlit
Project description
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)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
streamlit_avatar-0.1.3.tar.gz
(402.1 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file streamlit_avatar-0.1.3.tar.gz.
File metadata
- Download URL: streamlit_avatar-0.1.3.tar.gz
- Upload date:
- Size: 402.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
023893bd80db5a923d397fc64d27c7a972107da4f0bea0feb99a32f9363f2691
|
|
| MD5 |
6fc211d1479ed4747243762328c04ba1
|
|
| BLAKE2b-256 |
b7a209c6046b1934f79ce2c6d767f3c7760ce632685498e67af455a2ae962d4a
|
File details
Details for the file streamlit_avatar-0.1.3-py3-none-any.whl.
File metadata
- Download URL: streamlit_avatar-0.1.3-py3-none-any.whl
- Upload date:
- Size: 779.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
873e6f0022635eda29d6b76e570adcbc095d8e6d23f18dd1e288720b4736364d
|
|
| MD5 |
559ef3fe18d9ace84e252aedcf0219e9
|
|
| BLAKE2b-256 |
cf774b82378aa4caf7ef7701841b25a5406b3a3bb6171c8b9eee540553843b7f
|