import streamlit as st | |
from pymongo import MongoClient | |
import os | |
from transformers import pipeline, Conversation | |
# 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") | |
uinput = st.chat_input("Enter your message") | |
if uinput: | |
st.chat(uinput) | |
pipe = Conversation() | |
response = pipe(uinput) | |
st.chat(response) | |
print(response) | |