File size: 553 Bytes
3a66a27
43dad90
8da6c75
491741a
cf012cb
491741a
3a66a27
 
43dad90
 
3a66a27
43dad90
3a66a27
43dad90
 
3a66a27
43dad90
 
 
491741a
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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)