Nikhil0987 commited on
Commit
83f1d28
·
verified ·
1 Parent(s): b9d6d37

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -14
app.py CHANGED
@@ -3,20 +3,22 @@ import json
3
  import google.generativeai as genai
4
 
5
 
6
- def userinvoke():
7
- with open("test.json") as file:
8
- usersss = json.load(file)
9
- return usersss
10
-
11
-
12
- users = userinvoke()
13
-
14
-
15
- # routines = users[0]["routines"]
16
-
17
- # reminders = routines["reminders"][0]
18
-
19
-
 
 
20
 
21
 
22
  GOOGLE_API_KEY="AIzaSyCUBaL7TdISL7lRuBy19_X0-OsZfgbIgEc"
 
3
  import google.generativeai as genai
4
 
5
 
6
+ def add_to_json(new_data):
7
+ with open("test.json", "r") as file:
8
+ existing_data = json.load(file)
9
+
10
+ # Assuming you want to add 'new_goal' and 'reminder' into existing_data
11
+ existing_data.update(new_data)
12
+
13
+ with open("test.json", "w") as file:
14
+ json.dump(existing_data, file, indent=4)
15
+
16
+ # Usage:
17
+ new_data = {
18
+ "new_goal": "Master Streamlit",
19
+ "reminder": "Read tutorials"
20
+ }
21
+ add_to_json(new_data)
22
 
23
 
24
  GOOGLE_API_KEY="AIzaSyCUBaL7TdISL7lRuBy19_X0-OsZfgbIgEc"