File size: 4,017 Bytes
6d7e242
6b19fee
767ea81
6b19fee
6d7e242
eca08d2
6b19fee
6d7e242
 
 
 
eca08d2
f965549
 
 
 
 
 
 
1394f12
eca08d2
 
 
 
6d7e242
 
eca08d2
 
6d7e242
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6b19fee
e695e33
 
 
 
 
 
6cce895
c1666a3
6b19fee
6085666
 
 
 
 
 
6b19fee
6085666
 
 
 
922f180
 
40a52b2
 
c1666a3
 
6d7e242
 
0360f8e
6d7e242
 
 
 
 
 
0360f8e
6d7e242
 
6085666
6d7e242
 
6085666
6d7e242
 
 
6085666
6d7e242
 
 
 
6085666
6d7e242
 
 
0360f8e
6d7e242
 
 
 
0360f8e
6d7e242
 
0360f8e
6d7e242
 
 
0360f8e
6d7e242
 
 
0360f8e
6d7e242
 
0360f8e
6d7e242
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
import google.generativeai as palm
import streamlit as st 
import os 

# Set your API key
palm.configure(api_key = os.environ['PALM_KEY'])

# Select the PaLM 2 model
model = 'models/text-bison-001'

# Generate text
if prompt := st.chat_input("Hi, I can help you manage your daily tasks."):
    enprom = f""" 
    Understand whether user is asking to create a task or trying to have a general conversation 
    or is saying something which relates to a task creation thing and can be further discussed to know about task details.
    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.
    Else if user is trying to have just a normal general conversation, then give a reply accordingly.
    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 task you propose to achieve the goal.
    Follow all the above instruction for the below give input:  {prompt}"""
    completion = palm.generate_text(model=model, prompt=enprom, temperature=0.5, max_output_tokens=800)

# response = palm.chat(messages=["Hello."])
# print(response.last) #  'Hello! What can I help you with?'
# response.reply("Can you tell me a joke?")

# Print the generated text
    with st.chat_message("Assostant"):
        st.write(completion.result)





# import streamlit as st 
# from pymongo import MongoClient 
# from bardapi import Bard 
# import os 
# from plyer import notification as nt


# uri = os.environ["MONGO_CONNECTION_STRING"]
# client = MongoClient(uri, tlsCertificateKeyFile= "files/cert.pem")
# db = client["Cosmo"]
# col = db["Tasks"]

# def notifier():
#     nt.notify(
#         title = "This is notification",
#         message = "This is the message",
#         timeout = 10,
#         app_icon = "logo.png"
    # )


# task_values = {
#     "title" : st.text_input("Task Title"),
#     "prio" : st.text_input("Priority"),
#     "duedate" : st.text_input("Due Date"),
#     "status" : False
# }

# if st.button("Create Task"):
#     col.insert_one(task_values)
#     st.success("Task Created Successfully!")
#     st.balloons()


# if st.button("notify"):
#     st.toast("You have a new reminder")


# import streamlit as st
# from datetime import datetime

# def create_reminder(reminder_message, reminder_time):
#   # Create a reminder object.
#   reminder = {
#     "message": reminder_message,
#     "time": reminder_time
#   }

#   # Store the reminder in a database.
#   # ...

#   # Return the reminder object.
#   return reminder

# def show_reminder_notification(reminder):
#   # Calculate the time difference between the current time and the reminder time.
#   time_diff = reminder["time"] - datetime.now()

#   # If the time difference is less than or equal to 0, then show the reminder notification.
#   if time_diff <= 0:
#     # Create a Streamlit toast message.
#     toast = st.toast(reminder["message"], icon="ℹ️")

#     # Add buttons to the toast message to track the reminder as done or notdone.
#     done_button = st.button("Done")
#     notdone_button = st.button("Not done")

#     # If the done button is pressed, then mark the reminder as done.
#     if done_button:
#       # Update the reminder in the database as done.
#       # ...

#       # Close the toast message.
#       toast.close()

#     # If the notdone button is pressed, then dismiss the toast message.
#     elif notdone_button:
#       toast.close()

# # Get the user input for the reminder message and the time to remind.
# reminder_message = st.text_input("Enter reminder message:")
# reminder_time = st.time_input("Enter reminder time:")

# # Create a reminder object.
# reminder = create_reminder(reminder_message, reminder_time)

# # Show the reminder notification at the specified time.
# show_reminder_notification(reminder)