From 53a127f4182ab3eb73dac661a7c7e866b3119ce2 Mon Sep 17 00:00:00 2001 From: Dillon Laird Date: Fri, 26 Jul 2024 16:52:11 -0700 Subject: [PATCH] add image viewing --- examples/chat/app.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/examples/chat/app.py b/examples/chat/app.py index f0902e92..f1cd62e7 100644 --- a/examples/chat/app.py +++ b/examples/chat/app.py @@ -127,6 +127,22 @@ def main(): if st.button(file.name): st.session_state.file_path = file + if ( + "file_path" in st.session_state + and st.session_state.file_path is not None + and st.session_state.file_path.suffix + in ( + ".jpg", + ".jpeg", + ".png", + ".bmp", + ".webp", + ) + ): + st.image( + str(WORKSPACE / st.session_state.file_path), use_column_width=True + ) + with tabs[1]: if ( "file_path" not in st.session_state