File size: 3,015 Bytes
58c6cb9 80e86c3 58c6cb9 80e86c3 58c6cb9 80e86c3 58c6cb9 315c6e6 58c6cb9 80e86c3 58c6cb9 80e86c3 58c6cb9 80e86c3 58c6cb9 80e86c3 58c6cb9 80e86c3 58c6cb9 80e86c3 58c6cb9 80e86c3 58c6cb9 315c6e6 58c6cb9 c71bcec 58c6cb9 80e86c3 58c6cb9 |
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 |
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
st.set_page_config(layout="wide")
# classifyr = pipeline("zero-shot-classification")
# convo = pipeline("conversational")
# # classifi = pipeline(model="facebook/bart-large-mnli")
# 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']
listrem = bard.get_answer(f"Act as a ToDo Reminder AI who sets reminders or daily routine based upon the daily routine provided below:\n{anslist} \n\nMake a list of reminders with exact message, time, repetation frequecy, day/s kind of neccessary detail that would be required to set a reminder notification. Make it a numeric list.")['content']
# result = classifyr(user_input,candidate_labels=["reminders", "notes"])
with st.chat_message("assistant"):
st.write(f"What to do to achive the goal:\n{bardans}\n\nHow to do it:\n{anslist}\n\nList of Reminders you should make:\n{listrem}")
# with st.chat_message("user"):
# st.write(result["labels"][0])
# if ans["labels"][0] == "reminders":
# values = getValues(query.lower())
# with st.chat_message("assistant"):
# st.write(values)
# col.insert_one(values)
# elif ans["labels"][0] == "general conversation":
# umsg = bard.get_answer(query)["content"]
# with st.chat_message("assistant"):
# st.write(umsg)
# elif ans["labels"][0] == "notes":
# Notes = query.lower().replace( " create a new note", "",).replace(" no new note", "")
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"))
|