Spaces:
Build error
Build error
| import streamlit as st | |
| import json | |
| import google.generativeai as genai | |
| def add_to_json(new_data): | |
| with open("test.json", "r") as file: | |
| existing_data = json.load(file) | |
| # Assuming you want to add 'new_goal' and 'reminder' into existing_data | |
| existing_data.update(new_data) | |
| with open("test.json", "w") as file: | |
| json.dump(existing_data, file, indent=4) | |
| # Usage: | |
| new_data = { | |
| "goal": "enprom ", | |
| } | |
| GOOGLE_API_KEY="AIzaSyCUBaL7TdISL7lRuBy19_X0-OsZfgbIgEc" | |
| genai.configure(api_key=GOOGLE_API_KEY) | |
| model = genai.GenerativeModel('gemini-pro') | |
| if prompt := st.chat_input("Hi, how can I help you?"): | |
| enprom = f""" | |
| Act as a personal assistant, Understand user intent from the point of view for asking a few questions. ask to know more details about {prompt} | |
| :- {prompt}""" | |
| completetion = model.generate_content(enprom) | |
| with st.chat_message("Assistant"): | |
| st.write(completetion.text) | |