Update app.py
Browse files
app.py
CHANGED
@@ -3,6 +3,7 @@ import os
|
|
3 |
from transformers import pipeline
|
4 |
from bardapi import Bard
|
5 |
import os
|
|
|
6 |
|
7 |
bardkey = os.environ.get("BARD_API_KEY")
|
8 |
|
@@ -15,12 +16,16 @@ classifi = pipeline(model="facebook/bart-large-mnli")
|
|
15 |
|
16 |
def chatbot():
|
17 |
st.title("ChatBot")
|
18 |
-
if
|
19 |
ans = classifi(message, candidate_labels=["Reminder", "General Conversation"])
|
20 |
-
|
21 |
-
|
22 |
-
st.
|
23 |
-
|
|
|
|
|
|
|
|
|
24 |
|
25 |
|
26 |
|
|
|
3 |
from transformers import pipeline
|
4 |
from bardapi import Bard
|
5 |
import os
|
6 |
+
from getvalues import getValues
|
7 |
|
8 |
bardkey = os.environ.get("BARD_API_KEY")
|
9 |
|
|
|
16 |
|
17 |
def chatbot():
|
18 |
st.title("ChatBot")
|
19 |
+
if query := st.chat_input("Enter your message"):
|
20 |
ans = classifi(message, candidate_labels=["Reminder", "General Conversation"])
|
21 |
+
if ans["labels"][0] == "Reminder":
|
22 |
+
values = getValues(query)
|
23 |
+
with st.chat_message("assistant"):
|
24 |
+
st.write(values)
|
25 |
+
elif ans["labels"][0] == "General Conversation":
|
26 |
+
umsg = bard.get_answer(message)["content"]
|
27 |
+
with st.chat_message("assistant"):
|
28 |
+
st.write(umsg)
|
29 |
|
30 |
|
31 |
|