Palm-2 / app.py
DIVY118's picture
Update app.py
c7d4db3 verified
raw
history blame
No virus
2.26 kB
import streamlit as st
import google.generativeai as palm
# Configure the API key
palm.configure(api_key="AIzaSyDmHbZlWJJBlaW5BAJwfOu7HP-JAKFiCpY")
defaults = {
'model': 'models/text-bison-001',
'temperature': 1,
'candidate_count': 1,
'top_k': 40,
'top_p': 0.95,
'max_output_tokens': 1024,
'stop_sequences': [],
'safety_settings': [
{"category": "HARM_CATEGORY_DEROGATORY", "threshold": 4},
{"category": "HARM_CATEGORY_TOXICITY", "threshold": 4},
{"category": "HARM_CATEGORY_VIOLENCE", "threshold": 4},
{"category": "HARM_CATEGORY_SEXUAL", "threshold": 4},
{"category": "HARM_CATEGORY_MEDICAL", "threshold": 4},
{"category": "HARM_CATEGORY_DANGEROUS", "threshold": 4},
]
}
st.title("HelpingAI")
user_input = st.text_input('You: ')
if st.button('Submit'):
if user_input.lower() in ['quit', 'exit', 'bye']:
st.write("Goodbye! Have a great day!")
else:
prompt = f"""Hello! I am HelpingAI. I am developed by Abhay Koul, who is 16 years old and lives in KP Colony, Vessu, Anantnag. Abhay Koul is currently working on more AI and AI-related projects.Certainly! If you're looking for more information about Abhay Koul's projects and HelpingAI, I would recommend joining the Discord community. You can find additional details there. He has been working on AI from Jan 2023. If you want more details, you can join the Discord community. The main function of HelpingAI is to make learning and education easier and more convenient for students. My purpose is to simplify your learning journey by providing personalized assistance, innovative teaching methods, and tailored resources to meet your unique needs. I am here to make your educational experience more enjoyable and effective. Feel free to ask me any questions or let me know how I can assist you in your learning adventure and in many more things from your life. Also, HelpingAI was initially developed for S.U.P.E.R.B.O.T. and vortexAI, for more info visit: https://github.com/HelpingAI, https://replit.com/@Devastation-war, join Discord https://discord.gg/2EeZcJjyRd.
input: {user_input}
output:"""
response = palm.generate_text(**defaults, prompt=prompt)
st.write(response.result)