Update app.py
Browse files
app.py
CHANGED
@@ -11,10 +11,7 @@ st.write("I am your hotel booking assistant for today.")
|
|
11 |
# base="light"
|
12 |
# primaryColor="#6b4bff"
|
13 |
|
14 |
-
|
15 |
-
if model_Loading == True:
|
16 |
-
model = demo_chat.get_Model()
|
17 |
-
model_Loading = False
|
18 |
|
19 |
#Application
|
20 |
with st.container():
|
@@ -28,6 +25,9 @@ with st.container():
|
|
28 |
if 'chat_history' not in st.session_state:
|
29 |
st.session_state.chat_history = [ ] #Initialize chat history
|
30 |
|
|
|
|
|
|
|
31 |
#renders chat history
|
32 |
for message in st.session_state.chat_history:
|
33 |
with st.chat_message(message["role"]):
|
@@ -41,7 +41,7 @@ with st.container():
|
|
41 |
st.write(input_text)
|
42 |
st.session_state.chat_history.append({"role" : "user", "content" : input_text}) #append message to chat history
|
43 |
|
44 |
-
chat_response = demo_chat.demo_chain(input_text=input_text, memory=st.session_state.memory, model= model)
|
45 |
first_answer = chat_response.split("Human")[0] #Because of Predict it prints the whole conversation.Here we seperate the first answer only.
|
46 |
|
47 |
with st.chat_message("assistant"):
|
|
|
11 |
# base="light"
|
12 |
# primaryColor="#6b4bff"
|
13 |
|
14 |
+
model = demo_chat.get_Model()
|
|
|
|
|
|
|
15 |
|
16 |
#Application
|
17 |
with st.container():
|
|
|
25 |
if 'chat_history' not in st.session_state:
|
26 |
st.session_state.chat_history = [ ] #Initialize chat history
|
27 |
|
28 |
+
if 'model' not in st.session_state:
|
29 |
+
st.session_state.model = model
|
30 |
+
|
31 |
#renders chat history
|
32 |
for message in st.session_state.chat_history:
|
33 |
with st.chat_message(message["role"]):
|
|
|
41 |
st.write(input_text)
|
42 |
st.session_state.chat_history.append({"role" : "user", "content" : input_text}) #append message to chat history
|
43 |
|
44 |
+
chat_response = demo_chat.demo_chain(input_text=input_text, memory=st.session_state.memory, model= st.session_state.model)
|
45 |
first_answer = chat_response.split("Human")[0] #Because of Predict it prints the whole conversation.Here we seperate the first answer only.
|
46 |
|
47 |
with st.chat_message("assistant"):
|