Aaram / app.py
Nikhil0987's picture
Update app.py
d51420d verified
raw
history blame
1.04 kB
import streamlit as st
import json
import google.generativeai as genai
Goal =st.text_input("Enter your goal:")
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": Goal,
}
add_to_json(new_data)
GOOGLE_API_KEY="AIzaSyCUBaL7TdISL7lRuBy19_X0-OsZfgbIgEc"
genai.configure(api_key=GOOGLE_API_KEY)
model = genai.GenerativeModel('gemini-pro')
if userinput := st.chat_input("Hi"):
newuserinput = f"""
Act as a personal assistant, Understand users intent and tell user their intent while also motivating for setting goals from this input = {userinput}"""
answer = model.generate_content(newuserinput)
with st.chat_message("Assistant"):
st.write(answer.text)