shivanis14
commited on
Commit
•
c700fd1
1
Parent(s):
452874e
Update app.py
Browse files
app.py
CHANGED
@@ -438,7 +438,7 @@ if "product_selected" not in st.session_state:
|
|
438 |
st.session_state.product_selected = False
|
439 |
|
440 |
st.title("ConsumeWise")
|
441 |
-
st.write("Hello! I'm your food product analysis assistant.")
|
442 |
|
443 |
# Chat interface
|
444 |
for message in st.session_state.messages:
|
@@ -446,8 +446,8 @@ for message in st.session_state.messages:
|
|
446 |
st.markdown(message["content"])
|
447 |
|
448 |
# User input
|
449 |
-
if
|
450 |
-
st.session_state.messages.append({"role": "user", "content":
|
451 |
with st.chat_message("user"):
|
452 |
st.markdown(prompt)
|
453 |
|
@@ -457,7 +457,7 @@ if prompt := st.chat_input("What product would you like to analyze?"):
|
|
457 |
full_response = ""
|
458 |
|
459 |
# Simulate stream of response with milliseconds delay
|
460 |
-
similar_products, msg = chatbot_response(
|
461 |
for product in similar_products:
|
462 |
full_response += product + " "
|
463 |
message_placeholder.markdown(full_response + "▌")
|
@@ -486,7 +486,7 @@ if prompt := st.chat_input("What product would you like to analyze?"):
|
|
486 |
st.text_input("Please provide image URLs separated by commas:")
|
487 |
|
488 |
# Option to clear chat history
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
|
|
438 |
st.session_state.product_selected = False
|
439 |
|
440 |
st.title("ConsumeWise")
|
441 |
+
#st.write("Hello! I'm your food product analysis assistant.")
|
442 |
|
443 |
# Chat interface
|
444 |
for message in st.session_state.messages:
|
|
|
446 |
st.markdown(message["content"])
|
447 |
|
448 |
# User input
|
449 |
+
if product_name_by_user := st.chat_input("Enter name of the product you like to analyze? (Example : Marie Gold Biscuit)"):
|
450 |
+
st.session_state.messages.append({"role": "user", "content": product_name_by_user})
|
451 |
with st.chat_message("user"):
|
452 |
st.markdown(prompt)
|
453 |
|
|
|
457 |
full_response = ""
|
458 |
|
459 |
# Simulate stream of response with milliseconds delay
|
460 |
+
similar_products, msg = chatbot_response("", product_name_by_user, data_extractor_url, extract_info=False)
|
461 |
for product in similar_products:
|
462 |
full_response += product + " "
|
463 |
message_placeholder.markdown(full_response + "▌")
|
|
|
486 |
st.text_input("Please provide image URLs separated by commas:")
|
487 |
|
488 |
# Option to clear chat history
|
489 |
+
if st.button("Clear Chat History"):
|
490 |
+
st.session_state.messages = []
|
491 |
+
st.session_state.product_selected = False
|
492 |
+
st.rerun()
|