Spaces:
Sleeping
Sleeping
import streamlit as st | |
import json | |
import uuid | |
def rem(): | |
st.title("Reminders") | |
st.subheader("Enter reminder details:") | |
remid =str(uuid.uuid4()) | |
remsg =st.text_input("Enter Reminder Message:") | |
remtime = str(st.time_input("Enter Reminder Time:")) | |
remdate = str(st.date_input("Enter Reminder Date:")) | |
repeat =st.selectbox( | |
" would you like to repeat Reminder:",["No","daily","weekly","yearly"] | |
) | |
reminder ={ | |
"id": remid, | |
"message": remsg, | |
"time": remtime, | |
"date": remdate, | |
"repeat": repeat, | |
"status": False, | |
} | |
def save_data(): | |
with open ("database/data.json")as file: | |
data =json.load(file) | |
allnewreminder = data["reminders"] | |
allnewreminder.append(reminder) | |
<<<<<<< HEAD | |
======= | |
with open("database/data.json","w") as file: | |
json.dump(data,file,indent=4) | |
>>>>>>> 0113d4497feee757fe5f4c4f9db08e6bd5be92ed | |
with open("database/data.json","w") as file: | |
json.dump(data,file,indent=4) | |
st.button("Save",on_click=save_data) | |