Update app.py
Browse files
app.py
CHANGED
@@ -26,11 +26,11 @@ def interactive():
|
|
26 |
print("Hi! I am a simple AI chatbot built using Hugging Face and Streamlit.")
|
27 |
query = ""
|
28 |
while query != "quit":
|
29 |
-
if 'current_query' not in st.session_state or st.session_state['current_query'] != query:
|
30 |
st.session_state['current_query'] = query
|
31 |
-
st.text_input("Ask me something or type 'quit' to exit:", "", key='my_input', on_change=update_displayed_query)
|
32 |
-
|
33 |
-
if 'shown_query' not in st.session_state or st.session_state['shown_query'] != query:
|
34 |
st.session_state['shown_query'] = query
|
35 |
if len(query) > 0 and query != 'quit':
|
36 |
try:
|
@@ -40,6 +40,8 @@ def interactive():
|
|
40 |
except Exception as e:
|
41 |
st.write(f"Error occurred: {str(e)}")
|
42 |
|
|
|
|
|
43 |
if __name__ == "__main__":
|
44 |
st.set_page_config(layout="wide")
|
45 |
st.title('AI Chatbot Built Using Hugging Face and Streamlit')
|
|
|
26 |
print("Hi! I am a simple AI chatbot built using Hugging Face and Streamlit.")
|
27 |
query = ""
|
28 |
while query != "quit":
|
29 |
+
if ('current_query' not in st.session_state) or (st.session_state['current_query'] != query):
|
30 |
st.session_state['current_query'] = query
|
31 |
+
st.text_input("Ask me something or type 'quit' to exit:", "", key='my_input', on_change=lambda x: update_displayed_query(x["new"]))
|
32 |
+
|
33 |
+
if ('shown_query' not in st.session_state) or (st.session_state['shown_query'] != query):
|
34 |
st.session_state['shown_query'] = query
|
35 |
if len(query) > 0 and query != 'quit':
|
36 |
try:
|
|
|
40 |
except Exception as e:
|
41 |
st.write(f"Error occurred: {str(e)}")
|
42 |
|
43 |
+
query = st.session_state.get('current_query', '')
|
44 |
+
|
45 |
if __name__ == "__main__":
|
46 |
st.set_page_config(layout="wide")
|
47 |
st.title('AI Chatbot Built Using Hugging Face and Streamlit')
|