Spaces:
Runtime error
Runtime error
Upload 2 files
Browse files- app.py +32 -0
- requirements +2 -0
app.py
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import json
|
| 2 |
+
import requests
|
| 3 |
+
import streamlit as st
|
| 4 |
+
from streamlit_lottie import st_lottie
|
| 5 |
+
|
| 6 |
+
def load_lottiefile(filepath: str):
|
| 7 |
+
with open (filepath, "r") as f:
|
| 8 |
+
return json.load(f)
|
| 9 |
+
|
| 10 |
+
def load_lottieurl(url: str):
|
| 11 |
+
r = requests.get(url)
|
| 12 |
+
if r.status_code != 200:
|
| 13 |
+
return None
|
| 14 |
+
return r.json()
|
| 15 |
+
|
| 16 |
+
#lottiefile1 = load_lottiefile("lottie1.mp4")
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
lottie_hello1 = load_lottieurl("https://lottie.host/052aa43f-953d-4952-85c1-35c6f1eb58a1/vEApoSht1W.json")
|
| 20 |
+
|
| 21 |
+
lottie_hello2 = load_lottieurl("https://lottie.host/8789072e-2035-423f-87fd-f2da60f8c24e/3uWgRlTXln.json")
|
| 22 |
+
|
| 23 |
+
lottie_hello3 = load_lottieurl("https://lottie.host/0d478ac1-2a52-4535-b4d9-fa717e890ce2/rYVGu2yZp1.json")
|
| 24 |
+
|
| 25 |
+
st.title("Amazing animation using lottiefiles")
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
st_lottie(lottie_hello1,loop=True)
|
| 29 |
+
|
| 30 |
+
st_lottie(lottie_hello2,loop=True)
|
| 31 |
+
|
| 32 |
+
st_lottie(lottie_hello3,loop=True)
|
requirements
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
streamlit
|
| 2 |
+
streamlit_lottie
|