-
-
Save Sven-Bo/31d98f80b5fed1d3f53cf98e5b61e7c9 to your computer and use it in GitHub Desktop.
import json | |
import requests # pip install requests | |
import streamlit as st # pip install streamlit | |
from streamlit_lottie import st_lottie # pip install streamlit-lottie | |
# GitHub: https://github.com/andfanilo/streamlit-lottie | |
# Lottie Files: https://lottiefiles.com/ | |
def load_lottiefile(filepath: str): | |
with open(filepath, "r") as f: | |
return json.load(f) | |
def load_lottieurl(url: str): | |
r = requests.get(url) | |
if r.status_code != 200: | |
return None | |
return r.json() | |
lottie_coding = load_lottiefile("lottiefile.json") # replace link to local lottie file | |
lottie_hello = load_lottieurl("https://assets9.lottiefiles.com/packages/lf20_M9p23l.json") | |
st_lottie( | |
lottie_hello, | |
speed=1, | |
reverse=False, | |
loop=True, | |
quality="low", # medium ; high | |
renderer="svg", # canvas | |
height=None, | |
width=None, | |
key=None, | |
) |
Happy to hear that you found my videos helpful! Happy coding!
Hi how are you. Excuse me, I have a question; I try to run this code from a repository on Github, calling it with streamlit, but I get this message and I don't know how I could solve it. Could you guide me?
As written in the comment and in the error message, you need to install the streamlit-lottie package: pip install streamlit-lottie
I suggest creating a separate virtual environment and installing the required libraries there. This will ensure that you have a clean, isolated environment for running your Python code, which can help avoid conflicts with any other libraries that you have installed on your machine.
I cannot offer much Python debugging here in the comments, but I hope it gives you a starting point 😅 I hope you understand. Happy debugging!
Thank you very much. Greetings from a mexican in France.
Thank you very much. Greetings from a mexican in France.
@RoskoMx i faced the similar issue as well - just redeploy the app and you should be good. i think the issue has to do with caching in package initialization when we first deploy an app
I am struggling to learn Python-stream lit to develop some web app . With your help I am going forwards... But Still I have learn a lot more .
Anyway I love coding and pass my time... Thanks a lot and you people are helping me a lot.
Mano