A Streamlit custom component to load Lottie animations
Project description
Streamlit Lottie
Integrate Lottie animations inside your Streamlit app!
Install
pip install streamlit-lottie
Usage
from streamlit_lottie import st_lottie
from streamlit_lottie import st_lottie_spinner
def load_lottieurl(url: str):
r = requests.get(url)
if r.status_code != 200:
return None
return r.json()
lottie_url = "https://assets5.lottiefiles.com/packages/lf20_V9t630.json"
lottie_json = load_lottieurl(lottie_url)
st_lottie(lottie_json)
if st.button("Download"):
with st_lottie_spinner(lottie_json)
time.sleep(5)
st.balloons()
Development
Install
- JS side
cd frontend
npm install
- Python side
conda create -n streamlit-lottie python=3.7
conda activate streamlit-lottie
pip install -e .
Run
Both webpack dev server and Streamlit need to run for development mode.
- JS side
cd frontend
npm run start
- Python side
streamlit run app.py
References
- Lottie-web (Official)
- react-lottie (chenqingspring)
- lottie-react-web (felippenardi)
- lottie-react (gamote)
- lottie-react (LottieFiles)
- react-lottie-player (mifi)
- lottie-interactivity
Support me
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
streamlit-lottie-0.0.3.tar.gz
(756.9 kB
view hashes)
Built Distribution
Close
Hashes for streamlit_lottie-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b6ab8171d4423cdd14630dcae237fc339b998264dd57ff8810705e01d03f5c33 |
|
MD5 | 5ef580f063119f15c7c197bc0335d152 |
|
BLAKE2b-256 | f483d9f4607862bc435af4f8ac067d56923e0320b597425d20922f95dbaaa060 |