File size: 551 Bytes
3a66a27
43dad90
 
cf012cb
 
3a66a27
 
43dad90
 
3a66a27
43dad90
3a66a27
43dad90
 
3a66a27
43dad90
 
 
cf012cb
 
 
 
 
 
 
 
43dad90
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
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)