Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -15,15 +15,14 @@ def add_to_json(goal):
|
|
| 15 |
except FileNotFoundError:
|
| 16 |
data = {"goals": []} # Create the file with an empty 'goals' list if it doesn't exist
|
| 17 |
|
| 18 |
-
|
| 19 |
-
data["goals"] = []
|
| 20 |
|
| 21 |
new_item = {"Goal": goal}
|
| 22 |
data["goals"].append(new_item)
|
| 23 |
|
| 24 |
with open("test.json", "w") as file:
|
| 25 |
json.dump(data, file, indent=4)
|
| 26 |
-
|
| 27 |
|
| 28 |
GOOGLE_API_KEY = "AIzaSyCUBaL7TdISL7lRuBy19_X0-OsZfgbIgEc"
|
| 29 |
genai.configure(api_key=GOOGLE_API_KEY)
|
|
@@ -43,7 +42,7 @@ def main():
|
|
| 43 |
with st.chat_message("Assistant"):
|
| 44 |
st.write(completion.text)
|
| 45 |
|
| 46 |
-
|
| 47 |
|
| 48 |
# Display JSON Data
|
| 49 |
if st.button("Show JSON Data"):
|
|
|
|
| 15 |
except FileNotFoundError:
|
| 16 |
data = {"goals": []} # Create the file with an empty 'goals' list if it doesn't exist
|
| 17 |
|
| 18 |
+
|
|
|
|
| 19 |
|
| 20 |
new_item = {"Goal": goal}
|
| 21 |
data["goals"].append(new_item)
|
| 22 |
|
| 23 |
with open("test.json", "w") as file:
|
| 24 |
json.dump(data, file, indent=4)
|
| 25 |
+
add_to_json(goal)
|
| 26 |
|
| 27 |
GOOGLE_API_KEY = "AIzaSyCUBaL7TdISL7lRuBy19_X0-OsZfgbIgEc"
|
| 28 |
genai.configure(api_key=GOOGLE_API_KEY)
|
|
|
|
| 42 |
with st.chat_message("Assistant"):
|
| 43 |
st.write(completion.text)
|
| 44 |
|
| 45 |
+
|
| 46 |
|
| 47 |
# Display JSON Data
|
| 48 |
if st.button("Show JSON Data"):
|