Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -348,6 +348,7 @@ class ChatManager:
|
|
348 |
if len(st.session_state.uploaded_files) == 0:
|
349 |
response, status = ChatManager._handle_product_name(user_input)
|
350 |
else:
|
|
|
351 |
response, status = ChatManager._handle_product_url()
|
352 |
|
353 |
return response, status
|
@@ -377,6 +378,7 @@ class ChatManager:
|
|
377 |
st.markdown(f"Please provide images of the product since {len(st.session_state.similar_products)} similar products found in our database")
|
378 |
# Append the message to session state for chat history
|
379 |
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"})
|
|
|
380 |
st.chat_input("Please upload files ...", disabled=True)
|
381 |
|
382 |
uploaded_files = st.file_uploader(
|
@@ -387,18 +389,17 @@ class ChatManager:
|
|
387 |
|
388 |
print(f"DEBUG : uploaded_files after st.file_uploader() : {uploaded_files}")
|
389 |
|
390 |
-
if uploaded_files:
|
391 |
st.session_state.uploaded_files = uploaded_files
|
392 |
st.session_state.awaiting_image_upload = False
|
393 |
print(f"DEBUG: User uploaded files: {uploaded_files}")
|
394 |
return f"{len(uploaded_files)} images uploaded for analysis.", "no success"
|
395 |
|
396 |
-
#return "Waiting for image upload...", "no success"
|
397 |
else:
|
398 |
# Show a temporary message until files are uploaded
|
399 |
-
print(f"DEBUG: No uploaded files!")
|
400 |
st.info("Waiting for images to be uploaded.")
|
401 |
-
|
|
|
402 |
return "Waiting for images to be uploaded!", "no success"
|
403 |
|
404 |
@staticmethod
|
@@ -456,6 +457,7 @@ def main():
|
|
456 |
selection_in_progress = ProductSelector.handle_selection()
|
457 |
|
458 |
# Only show chat input if not awaiting selection
|
|
|
459 |
if not selection_in_progress:
|
460 |
user_input = st.chat_input("Enter your message:", key="user_input")
|
461 |
print(f"DEBUG - user_input : {user_input}")
|
|
|
348 |
if len(st.session_state.uploaded_files) == 0:
|
349 |
response, status = ChatManager._handle_product_name(user_input)
|
350 |
else:
|
351 |
+
print("Calling handle_product_url")
|
352 |
response, status = ChatManager._handle_product_url()
|
353 |
|
354 |
return response, status
|
|
|
378 |
st.markdown(f"Please provide images of the product since {len(st.session_state.similar_products)} similar products found in our database")
|
379 |
# Append the message to session state for chat history
|
380 |
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"})
|
381 |
+
|
382 |
st.chat_input("Please upload files ...", disabled=True)
|
383 |
|
384 |
uploaded_files = st.file_uploader(
|
|
|
389 |
|
390 |
print(f"DEBUG : uploaded_files after st.file_uploader() : {uploaded_files}")
|
391 |
|
392 |
+
if len(uploaded_files) > 0:
|
393 |
st.session_state.uploaded_files = uploaded_files
|
394 |
st.session_state.awaiting_image_upload = False
|
395 |
print(f"DEBUG: User uploaded files: {uploaded_files}")
|
396 |
return f"{len(uploaded_files)} images uploaded for analysis.", "no success"
|
397 |
|
|
|
398 |
else:
|
399 |
# Show a temporary message until files are uploaded
|
|
|
400 |
st.info("Waiting for images to be uploaded.")
|
401 |
+
print("Waiting for images to be uploaded!")
|
402 |
+
st.stop()
|
403 |
return "Waiting for images to be uploaded!", "no success"
|
404 |
|
405 |
@staticmethod
|
|
|
457 |
selection_in_progress = ProductSelector.handle_selection()
|
458 |
|
459 |
# Only show chat input if not awaiting selection
|
460 |
+
print(f"Selection in progress ? : {selection_in_progress}")
|
461 |
if not selection_in_progress:
|
462 |
user_input = st.chat_input("Enter your message:", key="user_input")
|
463 |
print(f"DEBUG - user_input : {user_input}")
|