Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -36,3 +36,26 @@ if st.button("notify"):
|
|
36 |
st.toast("You have a new reminder")
|
37 |
|
38 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
st.toast("You have a new reminder")
|
37 |
|
38 |
|
39 |
+
import time
|
40 |
+
|
41 |
+
def get_user_input():
|
42 |
+
reminder_message = st.text_input("Enter reminder message:")
|
43 |
+
reminder_time = st.time_input("Enter reminder time:")
|
44 |
+
return reminder_message, reminder_time
|
45 |
+
|
46 |
+
def show_toast_message(reminder_message, reminder_time):
|
47 |
+
# Calculate the time difference between the current time and the reminder time.
|
48 |
+
time_diff = reminder_time - time.localtime()
|
49 |
+
|
50 |
+
# If the time difference is less than or equal to 0, then show the toast message.
|
51 |
+
if time_diff <= 0:
|
52 |
+
st.toast(reminder_message, icon="ℹ️")
|
53 |
+
|
54 |
+
# Get the user input.
|
55 |
+
reminder_message, reminder_time = get_user_input()
|
56 |
+
|
57 |
+
# Show the toast message at the specified time.
|
58 |
+
show_toast_message(reminder_message, reminder_time)
|
59 |
+
|
60 |
+
|
61 |
+
|