Nikhil0987 commited on
Commit
05b0abe
·
verified ·
1 Parent(s): 0fae367

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -31
app.py CHANGED
@@ -1,39 +1,17 @@
1
- import google.generativeai as palm
2
  import streamlit as st
3
- import os
4
-
5
- # Set your API key
6
- palm.configure(api_key = os.environ['PALM_KEY'])
7
-
8
- # Select the PaLM 2 model
9
- model = 'models/text-bison-001'
10
-
11
- import google.generativeai as genai
12
- import streamlit as st
13
- import os
14
  import json
15
- import random
16
- # from getvalues import getValues
17
- from datetime import datetime, timedelta
18
- import uuid
19
- import re
20
 
21
- # Set your API key
22
- # Or use `os.getenv('GOOGLE_API_KEY')` to fetch an environment variable.
23
- GOOGLE_API_KEY=os.getenv('PALM_KEY')
24
 
25
  genai.configure(api_key=GOOGLE_API_KEY)
 
26
  model = genai.GenerativeModel('gemini-pro')
27
 
28
- # Generate text
29
- if prompt := st.chat_input("Hi, explain me what goal you want to achieve."):
30
  enprom = f"""
31
- Act as a personal assistant, Understand user intent from the point of view for creating a goal. ask to know more details about the goal.
32
- show your suggestions of routines or tasks which will help to achieve the goal as a table of 3 column of Task title, with time to invest, and repetation frequency.
33
- Follow all the above instruction for this given input:- {prompt}"""
34
- completion = model.generate_content(enprom)
35
-
36
- response = palm.chat(messages=["Hello."])
37
- print(response.last) # 'Hello! What can I help you with?'
38
- response.reply("Can you tell me a joke?")
39
-
 
 
1
  import streamlit as st
 
 
 
 
 
 
 
 
 
 
 
2
  import json
3
+ import google.generativeai as genai
 
 
 
 
4
 
5
+ GOOGLE_API_KEY="AIzaSyD0d-MGA3WRgxM5erRaTsFroXuHXktK9c4"
 
 
6
 
7
  genai.configure(api_key=GOOGLE_API_KEY)
8
+
9
  model = genai.GenerativeModel('gemini-pro')
10
 
11
+ if prompt := st.chat_input("Hi, how can I help you?"):
 
12
  enprom = f"""
13
+ 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}
14
+ :- {prompt}"""
15
+ completetion = model.generate_content(enprom)
16
+ with st.chat_message("Assistant"):
17
+ st.write(completetion.text)