| import streamlit as st | |
| import os | |
| from transformers import pipeline | |
| # from pymongo import MongoClient | |
| # uri = os.environ["MONGO_CONNECTION_STRING"] | |
| # client = MongoClient(uri, tlsCertificateKeyFile = "database/cert.pem") | |
| # db = client["testing"] | |
| # col = db["new"] | |
| # xyz = {"This is new code678"} | |
| # col.insert_one(xyz) | |
| token_classifier = pipeline(model="dslim/bert-base-NER", aggregation_strategy="simple") | |
| if ner := st.chat_input("query "): | |
| ans = token_classifier(ner) | |
| with st.chat_message("User"): | |
| st.write(ans) | |