Update app.py
Browse files
app.py
CHANGED
|
@@ -3,17 +3,28 @@ 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 |
# Generate text
|
| 12 |
-
prompt
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
# Print the generated text
|
| 16 |
-
st.
|
|
|
|
| 17 |
|
| 18 |
|
| 19 |
|
|
|
|
| 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 |
# Generate text
|
| 12 |
+
if prompt := st.chat_input("Hi, I can help you manage your daily tasks."):
|
| 13 |
+
enprom = f"""Understand whether user is asking to create a task or trying to have a general conversation
|
| 14 |
+
or is saying something which relates to a task creation thing and can be further discussed to know about task details.
|
| 15 |
+
If user is asking to create task then take all details for creating a task and send as a table for 4 columns i.e Task title, time, repetation, status.
|
| 16 |
+
Else if user is trying to have just a normal general conversation, then give a reply accordingly.
|
| 17 |
+
or if user is talking about something that can be related to a task and ask more question from the user to get more clarity about task details and show me the the discussions and question you had and also give me a table with those 4 columns for task details.
|
| 18 |
+
"""
|
| 19 |
+
completion = palm.generate_text(model=model, prompt=prompt, temperature=0.5, max_output_tokens=800)
|
| 20 |
+
|
| 21 |
+
# response = palm.chat(messages=["Hello."])
|
| 22 |
+
# print(response.last) # 'Hello! What can I help you with?'
|
| 23 |
+
# response.reply("Can you tell me a joke?")
|
| 24 |
|
| 25 |
# Print the generated text
|
| 26 |
+
with st.chat_message("Assostant"):
|
| 27 |
+
st.write(completion.result)
|
| 28 |
|
| 29 |
|
| 30 |
|