Spaces:
Sleeping
Sleeping
this
Browse files
app.py
CHANGED
|
@@ -10,8 +10,9 @@ from transformers import pipeline, Conversation
|
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
-
classifyr = pipeline("zero-shot-classification")
|
| 14 |
-
convo = pipeline("conversational")
|
|
|
|
| 15 |
|
| 16 |
uri = os.environ["MONGO_CONNECTION_STRING"]
|
| 17 |
client = MongoClient(uri, tlsCertificateKeyFile="database/cert.pem")
|
|
@@ -33,7 +34,7 @@ def view_rem():
|
|
| 33 |
def Chatbot():
|
| 34 |
st.title("Chatbot")
|
| 35 |
if query :=st.chat_input("Enter your message"):
|
| 36 |
-
ans =
|
| 37 |
if ans["labels"][0] == "reminders":
|
| 38 |
values = getValues(query.lower())
|
| 39 |
with st.chat_message("assistant"):
|
|
@@ -42,7 +43,7 @@ def Chatbot():
|
|
| 42 |
|
| 43 |
|
| 44 |
elif ans["labels"][0] == "general conversation":
|
| 45 |
-
umsg = bard.get_answer(
|
| 46 |
with st.chat_message("assistant"):
|
| 47 |
st.write(umsg)
|
| 48 |
|
|
|
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
+
# classifyr = pipeline("zero-shot-classification")
|
| 14 |
+
# convo = pipeline("conversational")
|
| 15 |
+
classifi = pipeline(model="facebook/bart-large-mnli")
|
| 16 |
|
| 17 |
uri = os.environ["MONGO_CONNECTION_STRING"]
|
| 18 |
client = MongoClient(uri, tlsCertificateKeyFile="database/cert.pem")
|
|
|
|
| 34 |
def Chatbot():
|
| 35 |
st.title("Chatbot")
|
| 36 |
if query :=st.chat_input("Enter your message"):
|
| 37 |
+
ans = classifi(query,candidate_labels=["reminders", "general conversation"])
|
| 38 |
if ans["labels"][0] == "reminders":
|
| 39 |
values = getValues(query.lower())
|
| 40 |
with st.chat_message("assistant"):
|
|
|
|
| 43 |
|
| 44 |
|
| 45 |
elif ans["labels"][0] == "general conversation":
|
| 46 |
+
umsg = bard.get_answer(query)["content"]
|
| 47 |
with st.chat_message("assistant"):
|
| 48 |
st.write(umsg)
|
| 49 |
|