Nikhil0987 commited on
Commit
9e04f95
·
1 Parent(s): 0a3fd1d
Files changed (2) hide show
  1. chat.py +28 -0
  2. home.py +31 -0
chat.py ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import pipeline, Conversation
2
+ # import streamlit_option_menu
3
+ import streamlit as st
4
+
5
+ def Chat():
6
+
7
+ query = st.chat_input("Enter your query")
8
+ convo = pipeline("conversational")
9
+ oracle = pipeline(task="zero-shot-classification", model="facebook/bart-large-mnli")
10
+ usrinput = Conversation(query)
11
+ chitchat = convo(usrinput)
12
+ ans = oracle(
13
+ query,
14
+ candidate_labels=["logout"])
15
+
16
+ if ans["scores"][0] > 0.85:
17
+ st.session_state["user"] = "visitor"
18
+ with st.chat_message("assistant"):
19
+ "You are now sleeping in dream"
20
+ st.experimental_rerun()
21
+ else:
22
+ with st.chat_message("assistant"):
23
+ chitchat
24
+
25
+
26
+ Chat()
27
+
28
+
home.py ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from streamlit_option_menu import option_menu
3
+ from chat import Chat
4
+
5
+ def homepage():
6
+ st.title("Home")
7
+ # st.header("Home Page")
8
+ st.subheader("Welcome to the Home Page")
9
+
10
+ def dashboard():
11
+ # st.title("Dashboard")
12
+ # st.header("Dashboard")
13
+
14
+ with st.sidebar:
15
+ selected = option_menu("Menu", ["Home", "Dashboard","Chat","Logout"], icons=['house', 'activity'], menu_icon="cast", default_index=0)
16
+ if selected == "Home":
17
+ homepage()
18
+
19
+ elif selected == "Dashboard":
20
+ "gfjfvjhvjhv"
21
+ elif selected == "Chat":
22
+ Chat()
23
+
24
+
25
+
26
+
27
+
28
+
29
+
30
+
31
+