import streamlit as st from pymongo import MongoClient import os from transformers import pipeline # uri = os.environ["MONGO_CONNECTION_STRING"] # client = MongoClient(uri, tlsCertificateKeyFile="database/cert.pem") # db = client["testing"] # col = db["new"] qna = pipeline("question-answering") knowledge = "My name is Ankush and I am excited to know about Artificial Intelligence" if query := st.chat_input("Question: "): ans = qna(question=query, context=knowledge) with st.chat_message("User"): st.write(ans["answer"])