Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,6 +2,30 @@ import streamlit as st
|
|
| 2 |
import json
|
| 3 |
import google.generativeai as genai
|
| 4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
GOOGLE_API_KEY="AIzaSyCwSszcd45k1Ce0B48oiQnYPRdTLh49kg8"
|
| 6 |
|
| 7 |
genai.configure(api_key=GOOGLE_API_KEY)
|
|
|
|
| 2 |
import json
|
| 3 |
import google.generativeai as genai
|
| 4 |
|
| 5 |
+
def add_to_json(new_data):
|
| 6 |
+
with open("data.json", "r") as file:
|
| 7 |
+
existing_data = json.load(file)
|
| 8 |
+
|
| 9 |
+
# Assuming you want to add 'new_goal' and 'reminder' into existing_data
|
| 10 |
+
existing_data.update(new_data)
|
| 11 |
+
|
| 12 |
+
with open("data.json", "w") as file:
|
| 13 |
+
json.dump(existing_data, file, indent=4)
|
| 14 |
+
|
| 15 |
+
# Usage:
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
|
| 29 |
GOOGLE_API_KEY="AIzaSyCwSszcd45k1Ce0B48oiQnYPRdTLh49kg8"
|
| 30 |
|
| 31 |
genai.configure(api_key=GOOGLE_API_KEY)
|