Spaces:
Sleeping
Sleeping
venkat charan
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -31,21 +31,20 @@ def end_conv():
|
|
31 |
st.write("Conversation ended.")
|
32 |
memory.clear()
|
33 |
user_input = st.text_area("Input Text")
|
34 |
-
for i in range(1,5):
|
35 |
|
36 |
# Generate and display the response
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
|
41 |
# Invoke the chain to get the response
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
|
47 |
# Save the context in memory
|
48 |
-
|
49 |
|
50 |
# Display the conversation history
|
51 |
#st.write("Conversation History:")
|
|
|
31 |
st.write("Conversation ended.")
|
32 |
memory.clear()
|
33 |
user_input = st.text_area("Input Text")
|
|
|
34 |
|
35 |
# Generate and display the response
|
36 |
+
if st.button("Generate Response"):
|
37 |
+
# Load current conversation history
|
38 |
+
history = memory.load_memory_variables({})['history']
|
39 |
|
40 |
# Invoke the chain to get the response
|
41 |
+
res = chain.invoke({"input": user_input})
|
42 |
+
response_content = res.content
|
43 |
+
st.write("Generated Response:")
|
44 |
+
st.write(response_content)
|
45 |
|
46 |
# Save the context in memory
|
47 |
+
memory.save_context({"input": user_input}, {"output": response_content})
|
48 |
|
49 |
# Display the conversation history
|
50 |
#st.write("Conversation History:")
|