Emerging-Tech/Task-Management
2
1# import google.generativeai as palm2# import streamlit as st 3# import os 4 5# # Set your API key6# palm.configure(api_key = os.environ['PALM_KEY'])7 8# # Select the PaLM 2 model9# model = 'models/text-bison-001'10 11import google.generativeai as genai12import streamlit as st13import os14import json15import random16# from getvalues import getValues17from datetime import datetime, timedelta18import uuid19import re20 21# Set your API key22# Or use `os.getenv('GOOGLE_API_KEY')` to fetch an environment variable.23GOOGLE_API_KEY=os.getenv('PALM_KEY')24 25genai.configure(api_key=GOOGLE_API_KEY)26model = genai.GenerativeModel('gemini-pro')27 28# Generate text29if 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?")39 40# Print the generated text41 with st.chat_message("Assistant"):42 st.write(completion.text)43 44 45 46 47 48# import streamlit as st 49# from pymongo import MongoClient 50# from bardapi import Bard 51# import os 52# from plyer import notification as nt53 54 55# uri = os.environ["MONGO_CONNECTION_STRING"]56# client = MongoClient(uri, tlsCertificateKeyFile= "files/cert.pem")57# db = client["Cosmo"]58# col = db["Tasks"]59 60# def notifier():61# nt.notify(62# title = "This is notification",63# message = "This is the message",64# timeout = 10,65# app_icon = "logo.png"66 # )67 68 69# task_values = {70# "title" : st.text_input("Task Title"),71# "prio" : st.text_input("Priority"),72# "duedate" : st.text_input("Due Date"),73# "status" : False74# }75 76# if st.button("Create Task"):77# col.insert_one(task_values)78# st.success("Task Created Successfully!")79# st.balloons()80 81 82# if st.button("notify"):83# st.toast("You have a new reminder")84 85 86# import streamlit as st87# from datetime import datetime88 89# def create_reminder(reminder_message, reminder_time):90# # Create a reminder object.91# reminder = {92# "message": reminder_message,93# "time": reminder_time94# }95 96# # Store the reminder in a database.97# # ...98 99# # Return the reminder object.100# return reminder101 102# def show_reminder_notification(reminder):103# # Calculate the time difference between the current time and the reminder time.104# time_diff = reminder["time"] - datetime.now()105 106# # If the time difference is less than or equal to 0, then show the reminder notification.107# if time_diff <= 0:108# # Create a Streamlit toast message.109# toast = st.toast(reminder["message"], icon="ℹ️")110 111# # Add buttons to the toast message to track the reminder as done or notdone.112# done_button = st.button("Done")113# notdone_button = st.button("Not done")114 115# # If the done button is pressed, then mark the reminder as done.116# if done_button:117# # Update the reminder in the database as done.118# # ...119 120# # Close the toast message.121# toast.close()122 123# # If the notdone button is pressed, then dismiss the toast message.124# elif notdone_button:125# toast.close()126 127# # Get the user input for the reminder message and the time to remind.128# reminder_message = st.text_input("Enter reminder message:")129# reminder_time = st.time_input("Enter reminder time:")130 131# # Create a reminder object.132# reminder = create_reminder(reminder_message, reminder_time)133 134# # Show the reminder notification at the specified time.135# show_reminder_notification(reminder)136 