import streamlit as st | |
import os | |
import pandas as pd | |
from transformers import pipeline, Conversation | |
convo = pipeline("conversational") | |
# Connecting to MongoDB | |
uri = os.environ["MONGO_CONNECTION_STRING"] | |
client = MongoClient(uri, tlsCertificateKeyFile="database/cert.pem") | |
db = client["myapp"] | |
col = db["chatbot"] | |
def chatbot(): | |
st.title("ChatBot") | |
if message := st.chat_input("Enter your message"): | |
umsg = Conversation(message) | |
answer = convo(umsg) | |
with st.chat_message("assistant"): | |
st.write(answer) |