|
import streamlit as st |
|
import os |
|
import pandas as pd |
|
|
|
from streamlit_option_menu import option_menu |
|
from bardapi import Bard |
|
from getvalues import getValues |
|
from pymongo import MongoClient |
|
from transformers import pipeline, Conversation |
|
|
|
|
|
|
|
classifyr = pipeline("zero-shot-classification") |
|
|
|
convo = pipeline("conversational") |
|
|
|
|
|
|
|
uri = os.environ["MONGO_CONNECTION_STRING"] |
|
client = MongoClient(uri, tlsCertificateKeyFile="database/cert.pem") |
|
|
|
db = client["myapp"] |
|
|
|
col = db["reminders"] |
|
|
|
bardkey = os.environ.get("BARD_API_KEY") |
|
|
|
bard = Bard(token=bardkey) |
|
|
|
def view_rem(): |
|
allrem = list(col.find()) |
|
remdata = pd.DataFrame(allrem) |
|
st.dataframe(remdata) |
|
|
|
|
|
def Chatbot(): |
|
st.title("Chatbot") |
|
if user_input := st.chat_input("Describe your goal. e.g: I want to achieve this goal in this time. Be as specific and explanatory as you can."): |
|
bardans = bard.get_answer(user_input)['content'] |
|
anslist = bard.get_answer(f"Make a list of this answer: \n{bardans} \nfor this goal: \n{user_input}\n\nThe list should be in two section, section 1 for all the reminders to track called Daily Routine and section 2 for all information that should be consumed to achieve the goal and stay very focused and motivated with excitement and this section is called Notes")['content'] |
|
|
|
with st.chat_message("assistant"): |
|
st.write(anslist) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Chatbot() |
|
|
|
|
|
def Create_Reminder(): |
|
st.title("Create Reminder") |
|
message = st.text_input("Share your plan of today") |
|
time = str(st.time_input("Time")) |
|
date = str(st.date_input("Date")) |
|
|
|
|