eaglelandsonce commited on
Commit
31bcc97
·
verified ·
1 Parent(s): 37b296f

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +35 -0
app.py ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json
2
+
3
+ import requests # pip install requests
4
+ import streamlit as st # pip install streamlit
5
+ from streamlit_lottie import st_lottie # pip install streamlit-lottie
6
+
7
+ # GitHub: https://github.com/andfanilo/streamlit-lottie
8
+ # Lottie Files: https://lottiefiles.com/
9
+
10
+ def load_lottiefile(filepath: str):
11
+ with open(filepath, "r") as f:
12
+ return json.load(f)
13
+
14
+
15
+ def load_lottieurl(url: str):
16
+ r = requests.get(url)
17
+ if r.status_code != 200:
18
+ return None
19
+ return r.json()
20
+
21
+
22
+ lottie_coding = load_lottiefile("lottiefile.json") # replace link to local lottie file
23
+ lottie_hello = load_lottieurl("https://assets9.lottiefiles.com/packages/lf20_M9p23l.json")
24
+
25
+ st_lottie(
26
+ lottie_hello,
27
+ speed=1,
28
+ reverse=False,
29
+ loop=True,
30
+ quality="low", # medium ; high
31
+ renderer="svg", # canvas
32
+ height=None,
33
+ width=None,
34
+ key=None,
35
+ )