Aaram / app.py
CosmoAI's picture
Update app.py
d9ca682 verified
raw
history blame
1.08 kB
import streamlit as st
import json
import google.generativeai as genai
# Load JSON configuration
# with open('config.json', 'r') as f:
# config = json.load(f)
#save json data
# def save_data():
# with open("data.json")as file:
# data =json.load(file)
# allchatlog = data["chatlog"]
# allchatlog.append(Chatlog)
# with open("data.json","w") as file:
# json.dump(data,file,indent=4 )
# Uinput = st.text_input()
# Output = GenAI.jobhi (uinput)
# Chatlog= {
# user: uinput,
# out : output}
# save_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"):
# newuserinputstring = 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(userinput)
with st.chat_message("Assistant"):
st.write(answer.text)