CosmoAI commited on
Commit
662b0f6
1 Parent(s): 2e367ae

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -13
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 query := st.chat_input("Enter your message"):
37
- ans = classifyr(query,candidate_labels=["reminders", "general conversation", "notes"])
38
- if ans["labels"][0] == "reminders":
39
- values = getValues(query.lower())
40
- with st.chat_message("assistant"):
41
- st.write(values)
42
- col.insert_one(values)
 
 
 
 
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
 
50
- elif ans["labels"][0] == "notes":
51
 
52
- Notes = entry.lower().replace( " create a new note", "",).replace(" no new note", "")
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