Spaces:
Build error
Build error
Wisdom Chen
commited on
Update amazon_app.py
Browse files- amazon_app.py +3 -4
amazon_app.py
CHANGED
@@ -31,7 +31,7 @@ def initialize_assistant():
|
|
31 |
load_data()
|
32 |
st.session_state.models_loaded = True
|
33 |
st.success("Assistant is ready!")
|
34 |
-
|
35 |
def display_chat_history():
|
36 |
for message in st.session_state.messages:
|
37 |
with st.chat_message(message["role"]):
|
@@ -39,12 +39,11 @@ def display_chat_history():
|
|
39 |
if "image" in message:
|
40 |
st.image(message["image"], caption="Uploaded Image", width=200)
|
41 |
if "display_images" in message:
|
42 |
-
|
43 |
-
img_data = message["display_images"][0] # Get the first (and only) image
|
44 |
st.image(
|
45 |
img_data['image'],
|
46 |
caption=f"{img_data['product_name']}\nPrice: ${img_data['price']:.2f}",
|
47 |
-
width=350
|
48 |
)
|
49 |
|
50 |
def handle_user_input(prompt, uploaded_image):
|
|
|
31 |
load_data()
|
32 |
st.session_state.models_loaded = True
|
33 |
st.success("Assistant is ready!")
|
34 |
+
|
35 |
def display_chat_history():
|
36 |
for message in st.session_state.messages:
|
37 |
with st.chat_message(message["role"]):
|
|
|
39 |
if "image" in message:
|
40 |
st.image(message["image"], caption="Uploaded Image", width=200)
|
41 |
if "display_images" in message:
|
42 |
+
img_data = message["display_images"][0]
|
|
|
43 |
st.image(
|
44 |
img_data['image'],
|
45 |
caption=f"{img_data['product_name']}\nPrice: ${img_data['price']:.2f}",
|
46 |
+
width=350
|
47 |
)
|
48 |
|
49 |
def handle_user_input(prompt, uploaded_image):
|