Spaces:
Sleeping
Sleeping
Update app.py
#3
by
CosmoAI
- opened
app.py
CHANGED
|
@@ -11,7 +11,9 @@ from transformers import pipeline, Conversation
|
|
| 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"]
|
|
@@ -33,23 +35,27 @@ def view_rem():
|
|
| 33 |
|
| 34 |
def Chatbot():
|
| 35 |
st.title("Chatbot")
|
| 36 |
-
if
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
|
| 44 |
|
| 45 |
-
elif ans["labels"][0] == "general conversation":
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
|
| 50 |
-
elif ans["labels"][0] == "notes":
|
| 51 |
|
| 52 |
-
|
| 53 |
|
| 54 |
|
| 55 |
|
|
|
|
| 11 |
|
| 12 |
|
| 13 |
classifyr = pipeline("zero-shot-classification")
|
| 14 |
+
|
| 15 |
convo = pipeline("conversational")
|
| 16 |
+
|
| 17 |
# classifi = pipeline(model="facebook/bart-large-mnli")
|
| 18 |
|
| 19 |
uri = os.environ["MONGO_CONNECTION_STRING"]
|
|
|
|
| 35 |
|
| 36 |
def Chatbot():
|
| 37 |
st.title("Chatbot")
|
| 38 |
+
if user_input := st.chat_input("Enter your message"):
|
| 39 |
+
result = classifyr(user_input,candidate_labels=["reminders", "general conversation", "notes", "nature", "technology", "maths", "business", "war"])
|
| 40 |
+
|
| 41 |
+
with st.chat_message("user"):
|
| 42 |
+
st.write(result["labels"][0])
|
| 43 |
+
|
| 44 |
+
# if ans["labels"][0] == "reminders":
|
| 45 |
+
# values = getValues(query.lower())
|
| 46 |
+
# with st.chat_message("assistant"):
|
| 47 |
+
# st.write(values)
|
| 48 |
+
# col.insert_one(values)
|
| 49 |
|
| 50 |
|
| 51 |
+
# elif ans["labels"][0] == "general conversation":
|
| 52 |
+
# umsg = bard.get_answer(query)["content"]
|
| 53 |
+
# with st.chat_message("assistant"):
|
| 54 |
+
# st.write(umsg)
|
| 55 |
|
| 56 |
+
# elif ans["labels"][0] == "notes":
|
| 57 |
|
| 58 |
+
# Notes = query.lower().replace( " create a new note", "",).replace(" no new note", "")
|
| 59 |
|
| 60 |
|
| 61 |
|