High guys I would like to design a web application and I have GIF image I want to display it on my sidebar please help me with your suggestions and ideas or instead if I want to use streamlit Lottie how can I display it on the sidebar
Thanks in advance
Here’s the code for using the lottie files. Use either one of the following options:
import streamlit as st
from streamlit_lottie import st_lottie # pip install streamlit-lottie
import json
import requests
# use any one of the following 2 options
# option #1
# for a local lottie file, use the following statements
vFile = "D:/Python/mylottiefile.json" # provide your full local file path
with open(vFile, "r") as fl:
LottieCode = json.load(fl)
# option #2
# for a web-based lottie, use the following statements
vFile = "https://assets5.lottiefiles.com/packages/lf20_V9t630.json"
r = requests.get(vFile)
LottieCode = None if r.status_code != 200 else r.json()
#--------------------show the lottie file in the sidebar
try:
with st.sidebar:
st_lottie(LottieCode, height=200, width=200, speed=1, loop=True)
except:
pass
Cheers
Thank you very much indeed for your assistance
Professor shwan