Aaram / app.py
Nikhil0987's picture
Update app.py
bc5c5f6 verified
raw
history blame
1.06 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 ("database/data.json")as file:
data =json.load(file)
allchatlog = data["chatlog"]
allchatlog.append(Chatlog)
with open("database/data.json","w") as file:
json.dump(data,file,indent=4 )
Uinput = st.textinput()
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 prompt := st.chat_input("Hi"):
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)