Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -33,6 +33,8 @@ if "pending_prompt" not in st.session_state:
|
|
33 |
st.session_state.pending_prompt = None
|
34 |
if "results" not in st.session_state:
|
35 |
st.session_state.results = []
|
|
|
|
|
36 |
|
37 |
# ------------------ Sidebar ------------------
|
38 |
st.sidebar.header("ℹ️ Information")
|
@@ -41,6 +43,7 @@ if st.sidebar.button("🧹 Clear Chat"):
|
|
41 |
st.session_state.thread_id = None
|
42 |
st.session_state.pending_prompt = None
|
43 |
st.session_state.results = []
|
|
|
44 |
st.rerun()
|
45 |
|
46 |
# ------------------ Chat Input ------------------
|
@@ -115,9 +118,15 @@ if st.session_state.results:
|
|
115 |
st.caption(item.get("summary", ""))
|
116 |
for url in item.get("images", [])[:1]:
|
117 |
if st.button("🖼️ View Image", key=f"view_{i}"):
|
118 |
-
st.
|
119 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
120 |
else:
|
121 |
for msg in st.session_state.messages:
|
122 |
with st.chat_message(msg["role"]):
|
123 |
-
st.markdown(msg["content"], unsafe_allow_html=True)
|
|
|
33 |
st.session_state.pending_prompt = None
|
34 |
if "results" not in st.session_state:
|
35 |
st.session_state.results = []
|
36 |
+
if "lightbox_url" not in st.session_state:
|
37 |
+
st.session_state.lightbox_url = None
|
38 |
|
39 |
# ------------------ Sidebar ------------------
|
40 |
st.sidebar.header("ℹ️ Information")
|
|
|
43 |
st.session_state.thread_id = None
|
44 |
st.session_state.pending_prompt = None
|
45 |
st.session_state.results = []
|
46 |
+
st.session_state.lightbox_url = None
|
47 |
st.rerun()
|
48 |
|
49 |
# ------------------ Chat Input ------------------
|
|
|
118 |
st.caption(item.get("summary", ""))
|
119 |
for url in item.get("images", [])[:1]:
|
120 |
if st.button("🖼️ View Image", key=f"view_{i}"):
|
121 |
+
st.session_state.lightbox_url = url
|
122 |
+
|
123 |
+
if st.session_state.lightbox_url:
|
124 |
+
st.markdown("---")
|
125 |
+
st.image(st.session_state.lightbox_url, use_column_width=True, caption="🔍 Enlarged Preview")
|
126 |
+
if st.button("❌ Close Viewer"):
|
127 |
+
st.session_state.lightbox_url = None
|
128 |
+
st.rerun()
|
129 |
else:
|
130 |
for msg in st.session_state.messages:
|
131 |
with st.chat_message(msg["role"]):
|
132 |
+
st.markdown(msg["content"], unsafe_allow_html=True)
|