Skip to main content

A Streamlit custom component to load Lottie animations

Project description

Streamlit Lottie

Streamlit App

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

Support me

Buy Me A Coffee

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)

Uploaded source

Built Distribution

streamlit_lottie-0.0.3-py3-none-any.whl (769.4 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page