import streamlit as st import os 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"] def Chatbot(): st.title("Chatbot") if message :=st.chat_input("Enter your message"): ans = classifyr(message,candidate_labels=["reminders", "general conversation"]) if ans["labels"][0] == "reminders": values = getValues(x.lower()) with st.chat_message("assistant"): st.write(values) col.insert_one(values) elif ans["labels"][0] == "general conversation": umsg = bard.get_answer(message)["content"] with st.chat_message("assistant"): st.write(umsg) 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"))