this
Browse files
app.py
CHANGED
|
@@ -1,12 +1,20 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
from pymongo import MongoClient
|
| 3 |
import os
|
|
|
|
| 4 |
|
| 5 |
|
| 6 |
-
uri = os.environ["MONGO_CONNECTION_STRING"]
|
| 7 |
-
client = MongoClient(uri, tlsCertificateKeyFile="database/cert.pem")
|
| 8 |
-
db = client["testing"]
|
| 9 |
-
col = db["new"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
-
xyz = {"message" : "it raining" }
|
| 12 |
-
col.insert_one(xyz)
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
from pymongo import MongoClient
|
| 3 |
import os
|
| 4 |
+
from transformes import pipeline
|
| 5 |
|
| 6 |
|
| 7 |
+
# uri = os.environ["MONGO_CONNECTION_STRING"]
|
| 8 |
+
# client = MongoClient(uri, tlsCertificateKeyFile="database/cert.pem")
|
| 9 |
+
# db = client["testing"]
|
| 10 |
+
# col = db["new"]
|
| 11 |
+
|
| 12 |
+
qna = pipeline("question-answering")
|
| 13 |
+
|
| 14 |
+
knowledge = "My name is Ankush and I am excited to know about Artificial Intelligence"
|
| 15 |
+
|
| 16 |
+
if query := st.chat_input("Question: "):
|
| 17 |
+
ans = qna(question=query, context=knowledge)
|
| 18 |
+
with st.chat_message("User"):
|
| 19 |
+
st.write(ans)
|
| 20 |
|
|
|
|
|
|