Abhaykoul commited on
Commit
60a8c9a
1 Parent(s): cec8cfb

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +38 -0
app.py ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import google.generativeai as palm
3
+
4
+ # Configure the API key
5
+ palm.configure(api_key="AIzaSyCnrcQWTEedcGuEsJ9Uhbj_ZS9B2nozMiU")
6
+
7
+ defaults = {
8
+ 'model': 'models/text-bison-001',
9
+ 'temperature': 1,
10
+ 'candidate_count': 1,
11
+ 'top_k': 40,
12
+ 'top_p': 0.95,
13
+ 'max_output_tokens': 1024,
14
+ 'stop_sequences': [],
15
+ 'safety_settings': [
16
+ {"category": "HARM_CATEGORY_DEROGATORY", "threshold": 4},
17
+ {"category": "HARM_CATEGORY_TOXICITY", "threshold": 4},
18
+ {"category": "HARM_CATEGORY_VIOLENCE", "threshold": 4},
19
+ {"category": "HARM_CATEGORY_SEXUAL", "threshold": 4},
20
+ {"category": "HARM_CATEGORY_MEDICAL", "threshold": 4},
21
+ {"category": "HARM_CATEGORY_DANGEROUS", "threshold": 4},
22
+ ]
23
+ }
24
+
25
+ st.title("HelpingAI")
26
+
27
+ user_input = st.text_input('You: ')
28
+
29
+ if st.button('Submit'):
30
+ if user_input.lower() in ['quit', 'exit', 'bye']:
31
+ st.write("Goodbye! Have a great day!")
32
+ else:
33
+ 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.
34
+ input: {user_input}
35
+ output:"""
36
+
37
+ response = palm.generate_text(**defaults, prompt=prompt)
38
+ st.write(response.result)