This repository contains a simple Python script that integrates with Streamlit to send push notifications directly from your Streamlit app. The notifications can include a title, body, icon, and sound.
- Customizable Notifications: Specify the notification title, body, icon, and sound.
- Browser-Based Notifications: Utilizes the browser's native notification API.
- Audio Alerts: Plays a sound alongside the notification.
pip install git+https://github.com/yunisguliyev/streamlit-notifications.gitor
pip install streamlit-notificationsimport streamlit as st
from streamlit_notifications import send_alert, send_push
st.write("Sending notification alert!")
if st.button("send notification"):
send_alert(message="Hello from streamlit_notifications ")
if st.button("notification"):
send_push(title= "Pass TITLE as an argument 🔥", body = "Pass BODY as an argument 👨🏻💻")title: The title of the notification (default is"Pass TITLE as an argument 🔥").body: The body text of the notification (default is"Pass BODY as an argument 👨🏻💻").icon_path: The path to an icon image (default is an empty string, meaning no icon).sound_path: The path to an audio file to be played with the notification (default is a sound from Pixabay).tag: A tag to group notifications (default is an empty string).
- Notification API: The script uses the JavaScript Notification API to create notifications.
- Media Handling: Streamlit’s media file manager handles uploading, and serving icon, and audio files.
If the icon or sound file cannot be uploaded to the server, the script returns to using a default or the provided path directly.
Feel free to contribute by submitting issues or pull requests. Any enhancements or bug fixes are welcome! Also you can contanct me via LinkedIn
This project is licensed under the MIT License. See the LICENSE file for details.