Spaces:
Build error
Build error
Update app.py
Browse files
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
|
16 |
-
# from getvalues import getValues
|
17 |
-
from datetime import datetime, timedelta
|
18 |
-
import uuid
|
19 |
-
import re
|
20 |
|
21 |
-
|
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 |
-
|
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
|
32 |
-
|
33 |
-
|
34 |
-
|
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)
|
|
|
|
|
|
|
|