Download app.py from Geek7/dl3: direct link, hf CLI and curl.
- Browser
- Download file 941 Bytes
-
https://huggingface.co/spaces/Geek7/dl3/resolve/main/app.py
- Command line
-
hf download hf://spaces/Geek7/dl3/app.py
-
curl -L -o app.py https://huggingface.co/spaces/Geek7/dl3/resolve/main/app.py
941 Bytes
| import streamlit as st | |
| import streamlit.components.v1 as components | |
| # JavaScript code for confetti animation | |
| confetti_animation_script = """ | |
| <script src="https://cdn.jsdelivr.net/npm/canvas-confetti@1.9.2/dist/confetti.browser.min.js"></script> | |
| <script> | |
| function triggerConfetti() { | |
| confetti({ | |
| angle: randomInRange(55, 125), | |
| particleCount: randomInRange(50, 100), | |
| origin: { y: 0.6 }, | |
| spread: randomInRange(50, 70), | |
| }); | |
| } | |
| function randomInRange(min, max) { | |
| return Math.random() * (max - min) + min; | |
| } | |
| </script> | |
| """ | |
| # Display the confetti animation script | |
| components.html(confetti_animation_script, height=0) | |
| # Button to trigger confetti using onclick method | |
| confetti_button = st.button("Click for Confetti", on_click="triggerConfetti()") | |
| if confetti_button: | |
| st.empty() # Optional, clears the button after clicking | |
| st.write("Confetti time!") |