| # 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' | |
| import google.generativeai as genai | |
| import streamlit as st | |
| import os | |
| import json | |
| import random | |
| # from getvalues import getValues | |
| from datetime import datetime, timedelta | |
| import uuid | |
| import re | |
| # Set your API key | |
| # Or use `os.getenv('GOOGLE_API_KEY')` to fetch an environment variable. | |
| GOOGLE_API_KEY=os.getenv('PALM_KEY') | |
| genai.configure(api_key=GOOGLE_API_KEY) | |
| model = genai.GenerativeModel('gemini-pro') | |
| # Generate text | |
| if prompt := st.chat_input("Hi, explain me what goal you want to achieve."): | |
| enprom = f""" | |
| 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. | |
| 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. | |
| Follow all the above instruction for this given input:- {prompt}""" | |
| completion = model.generate_content(enprom) | |
| # 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("Assistant"): | |
| st.write(completion.text) | |
| # 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) | |