Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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?")
|