shivanis14 commited on
Commit
83cf2b8
1 Parent(s): 1b87b57

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -1
app.py CHANGED
@@ -411,7 +411,7 @@ def chatbot_response(image_urls_str, product_name_by_user, data_extractor_url, e
411
  return [], final_analysis
412
 
413
  else:
414
- return [], "Product not found in our database. Please provide an image URL (Example : http://example.com/image.jpg)"
415
 
416
  elif "http:/" in image_urls_str.lower() or "https:/" in image_urls_str.lower():
417
  # Extract image URL from user input
@@ -484,6 +484,23 @@ if product_name_by_user := st.chat_input("Enter name of the product you like to
484
  st.session_state.messages.append({"role": "assistant", "content": detailed_response})
485
  elif choice == "None of the above":
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"):
 
411
  return [], final_analysis
412
 
413
  else:
414
+ return [], "Product not found in our database."
415
 
416
  elif "http:/" in image_urls_str.lower() or "https:/" in image_urls_str.lower():
417
  # Extract image URL from user input
 
484
  st.session_state.messages.append({"role": "assistant", "content": detailed_response})
485
  elif choice == "None of the above":
486
  st.text_input("Please provide image URLs separated by commas:")
487
+
488
+ elif len(similar_products) == 0:
489
+ # Save response of the user to the last message by assistant (full_response)
490
+ # Get image URLs from user input
491
+ image_urls_str = st.text_input("Please provide image URLs separated by commas:")
492
+
493
+ # Add user message to chat history
494
+ st.session_state.messages.append({"role": "user", "content": image_urls_str})
495
+
496
+ with st.chat_message("user"):
497
+ st.markdown(image_urls_str)
498
+
499
+ # Generate detailed response for the image URLs
500
+ with st.chat_message("assistant"):
501
+ _, detailed_response = chatbot_response(image_urls_str, "", data_extractor_url, extract_info=True)
502
+ st.markdown(detailed_response)
503
+ st.session_state.messages.append({"role": "assistant", "content": detailed_response})
504
 
505
  # Option to clear chat history
506
  if st.button("Clear Chat History"):