Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -358,23 +358,24 @@ class ChatManager:
|
|
358 |
[], user_input, extract_info=False
|
359 |
)
|
360 |
|
361 |
-
|
|
|
362 |
if len(similar_products) > 0:
|
363 |
-
st.session_state.similar_products = similar_products
|
364 |
st.session_state.awaiting_selection = True
|
365 |
return "Here are some similar products from our database. Please select:", "no success"
|
366 |
|
367 |
-
|
368 |
-
with st.chat_message("assistant"):
|
369 |
-
st.markdown(f"Please provide images of the product since {len(similar_products)} similar products found in our database")
|
370 |
# Add a file uploader to allow users to upload multiple images
|
371 |
# No similar products found
|
372 |
st.session_state.awaiting_image_upload = True
|
373 |
|
374 |
# Only show message and uploader if waiting for image upload
|
375 |
-
|
376 |
-
st.
|
377 |
-
|
|
|
|
|
|
|
378 |
uploaded_files = st.file_uploader(
|
379 |
"Upload product images here:",
|
380 |
type=["jpg", "jpeg", "png"],
|
@@ -385,8 +386,8 @@ class ChatManager:
|
|
385 |
st.session_state.uploaded_files = uploaded_files
|
386 |
st.session_state.awaiting_image_upload = False
|
387 |
return f"{len(uploaded_files)} images uploaded for analysis.", "no success"
|
388 |
-
else:
|
389 |
-
|
390 |
|
391 |
@staticmethod
|
392 |
def _handle_product_url():
|
|
|
358 |
[], user_input, extract_info=False
|
359 |
)
|
360 |
|
361 |
+
st.session_state.similar_products = similar_products
|
362 |
+
|
363 |
if len(similar_products) > 0:
|
|
|
364 |
st.session_state.awaiting_selection = True
|
365 |
return "Here are some similar products from our database. Please select:", "no success"
|
366 |
|
367 |
+
|
|
|
|
|
368 |
# Add a file uploader to allow users to upload multiple images
|
369 |
# No similar products found
|
370 |
st.session_state.awaiting_image_upload = True
|
371 |
|
372 |
# Only show message and uploader if waiting for image upload
|
373 |
+
while st.session_state.awaiting_image_upload:
|
374 |
+
with st.chat_message("assistant"):
|
375 |
+
st.markdown(f"Please provide images of the product since {len(st.session_state.similar_products)} similar products found in our database")
|
376 |
+
# Append the message to session state for chat history
|
377 |
+
st.session_state.messages.append({"role": "assistant", "content": f"Please provide images of the product since {len(st.session_state.similar_products)} similar products found in our database"})
|
378 |
+
|
379 |
uploaded_files = st.file_uploader(
|
380 |
"Upload product images here:",
|
381 |
type=["jpg", "jpeg", "png"],
|
|
|
386 |
st.session_state.uploaded_files = uploaded_files
|
387 |
st.session_state.awaiting_image_upload = False
|
388 |
return f"{len(uploaded_files)} images uploaded for analysis.", "no success"
|
389 |
+
#else:
|
390 |
+
# return "Waiting for images!", "no success"
|
391 |
|
392 |
@staticmethod
|
393 |
def _handle_product_url():
|