Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -377,7 +377,8 @@ 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 |
-
|
|
|
381 |
uploaded_files = st.file_uploader(
|
382 |
"Upload product images here:",
|
383 |
type=["jpg", "jpeg", "png"],
|
@@ -392,13 +393,13 @@ class ChatManager:
|
|
392 |
print(f"DEBUG: User uploaded files: {uploaded_files}")
|
393 |
return f"{len(uploaded_files)} images uploaded for analysis.", "no success"
|
394 |
|
395 |
-
return "Waiting for image upload...", "no success"
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
|
403 |
@staticmethod
|
404 |
def _handle_product_url():
|
@@ -485,8 +486,8 @@ def main():
|
|
485 |
|
486 |
#else:
|
487 |
# print(f"DEBUG : st.session_state.awaiting_selection : {st.session_state.awaiting_selection}")
|
488 |
-
|
489 |
-
|
490 |
else:
|
491 |
# Disable chat input while selection is in progress
|
492 |
st.chat_input("Please confirm your selection above first...", disabled=True)
|
|
|
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(
|
383 |
"Upload product images here:",
|
384 |
type=["jpg", "jpeg", "png"],
|
|
|
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 |
+
st.stop() # Prevent further execution until user interacts
|
402 |
+
# return "Waiting for images to be uploaded!", "no success"
|
403 |
|
404 |
@staticmethod
|
405 |
def _handle_product_url():
|
|
|
486 |
|
487 |
#else:
|
488 |
# print(f"DEBUG : st.session_state.awaiting_selection : {st.session_state.awaiting_selection}")
|
489 |
+
print("Re-running...")
|
490 |
+
st.experimental_rerun()
|
491 |
else:
|
492 |
# Disable chat input while selection is in progress
|
493 |
st.chat_input("Please confirm your selection above first...", disabled=True)
|