Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -7,24 +7,18 @@ import google.generativeai as genai
|
|
7 |
|
8 |
|
9 |
|
10 |
-
def add_to_json(
|
11 |
with open("test.json", "r") as file:
|
12 |
-
|
13 |
|
14 |
-
|
15 |
-
|
|
|
|
|
|
|
16 |
|
17 |
with open("test.json", "w") as file:
|
18 |
-
json.dump(
|
19 |
-
|
20 |
-
# Usage:
|
21 |
-
new_data = {
|
22 |
-
|
23 |
-
|
24 |
-
"goal": "enprom ",
|
25 |
-
|
26 |
-
|
27 |
-
}
|
28 |
|
29 |
|
30 |
GOOGLE_API_KEY="AIzaSyCUBaL7TdISL7lRuBy19_X0-OsZfgbIgEc"
|
|
|
7 |
|
8 |
|
9 |
|
10 |
+
def add_to_json(new_goal, new_reminder):
|
11 |
with open("test.json", "r") as file:
|
12 |
+
data = json.load(file)
|
13 |
|
14 |
+
new_item = {
|
15 |
+
"goal": new_goal,
|
16 |
+
"reminder": new_reminder
|
17 |
+
}
|
18 |
+
data["goals"].append(new_item)
|
19 |
|
20 |
with open("test.json", "w") as file:
|
21 |
+
json.dump(data, file, indent=4)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
|
23 |
|
24 |
GOOGLE_API_KEY="AIzaSyCUBaL7TdISL7lRuBy19_X0-OsZfgbIgEc"
|