Ankush05 commited on
Commit
ef7a692
1 Parent(s): f2b4ffb
Files changed (1) hide show
  1. app.py +12 -5
app.py CHANGED
@@ -1,15 +1,17 @@
1
  import streamlit as st
2
  import os
3
- from bardapi import Bard
4
 
 
 
5
  from getvalues import getValues
6
  from pymongo import MongoClient
7
  from transformers import pipeline, Conversation
8
 
9
 
10
 
11
- classifyr = pipeline("zero-shot-classification")
12
- convo = pipeline("conversational")
13
 
14
  uri = os.environ["MONGO_CONNECTION_STRING"]
15
  client = MongoClient(uri, tlsCertificateKeyFile="database/cert.pem")
@@ -21,13 +23,19 @@ col = db["reminders"]
21
  bardkey = os.environ.get("BARD_API_KEY")
22
 
23
  bard = Bard(token=bardkey)
 
 
 
 
 
 
24
 
25
  def Chatbot():
26
  st.title("Chatbot")
27
  if query :=st.chat_input("Enter your message"):
28
  ans = classifyr(query,candidate_labels=["reminders", "general conversation"])
29
  if ans["labels"][0] == "reminders":
30
- values = getValues(ans.lower())
31
  with st.chat_message("assistant"):
32
  st.write(values)
33
  col.insert_one(values)
@@ -35,7 +43,6 @@ def Chatbot():
35
 
36
  elif ans["labels"][0] == "general conversation":
37
  umsg = bard.get_answer(message)["content"]
38
-
39
  with st.chat_message("assistant"):
40
  st.write(umsg)
41
 
 
1
  import streamlit as st
2
  import os
3
+ import pandas as pd
4
 
5
+ from streamlit_option_menu import option_menu
6
+ from bardapi import Bard
7
  from getvalues import getValues
8
  from pymongo import MongoClient
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")
 
23
  bardkey = os.environ.get("BARD_API_KEY")
24
 
25
  bard = Bard(token=bardkey)
26
+
27
+ def view_rem():
28
+ allrem = list(col.find())
29
+ remdata = pd.DataFrame(allrem)
30
+ st.dataframe(remdata)
31
+
32
 
33
  def Chatbot():
34
  st.title("Chatbot")
35
  if query :=st.chat_input("Enter your message"):
36
  ans = classifyr(query,candidate_labels=["reminders", "general conversation"])
37
  if ans["labels"][0] == "reminders":
38
+ values = getValues(query.lower())
39
  with st.chat_message("assistant"):
40
  st.write(values)
41
  col.insert_one(values)
 
43
 
44
  elif ans["labels"][0] == "general conversation":
45
  umsg = bard.get_answer(message)["content"]
 
46
  with st.chat_message("assistant"):
47
  st.write(umsg)
48