focusit commited on
Commit
19d1fe3
·
1 Parent(s): c2274d3

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +60 -0
  2. requirements.txt +5 -0
app.py ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ from pymongo.mongo_client import MongoClient
3
+ import streamlit as st
4
+ from streamlit_option_menu import option_menu
5
+
6
+
7
+
8
+ uri = os.environ["MONGO_CONNECTION_STRING"]
9
+
10
+ client = MongoClient(uri, tlsCertificateKeyFile="cert/cert.pem")
11
+
12
+ db = client["myapp"]
13
+
14
+ col = db["users"]
15
+
16
+
17
+ try:
18
+ client.admin.command('ping')
19
+ print("Connection Established!")
20
+ except Exception as e:
21
+ print(e)
22
+
23
+
24
+ def create_rem():
25
+ remmsg = st.text_input("What do you want to be reminded about")
26
+ date = str(st.date_input("When do you want to be reminded"))
27
+ time = str(st.time_input("At what time do you want to be reminded"))
28
+
29
+ newrem = {
30
+ "message": remmsg,
31
+ "date": date,
32
+ "time": time
33
+ }
34
+ col.insert_one(newrem)
35
+
36
+
37
+ def view_rem():
38
+ allrem = col.find()
39
+ st.json(allrem)
40
+
41
+
42
+ def main():
43
+ selected = option_menu(None, ["Create Reminder", "View Reminders"])
44
+
45
+ if selected == "Create Reminder":
46
+ create_rem()
47
+ elif selected == "View Reminders":
48
+ view_rem()
49
+
50
+
51
+ main()
52
+
53
+
54
+
55
+
56
+
57
+
58
+
59
+
60
+
requirements.txt ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ pymongo
2
+ dnspython
3
+ streamlit
4
+ streamlit-option-menu
5
+ transformers[torch]