diff --git a/monai_vila2d/demo/gradio_monai_vila2d.py b/monai_vila2d/demo/gradio_monai_vila2d.py
index 64a9456..a470aad 100644
--- a/monai_vila2d/demo/gradio_monai_vila2d.py
+++ b/monai_vila2d/demo/gradio_monai_vila2d.py
@@ -79,6 +79,7 @@
["Segment the visceral structures in the current image."],
["Can you identify any liver masses or tumors?"],
["Segment the entire image."],
+ ["Describe the image in detail"],
]
EXAMPLE_PROMPTS_2D = [
@@ -90,6 +91,7 @@
["Is there evidence of cardiomegaly in this image?"],
["Is the atelectasis located on the left side or right side?"],
["What level is the cardiomegaly?"],
+ ["Describe the image in detail"],
]
HTML_PLACEHOLDER = "
".join([""] * 15)
@@ -275,6 +277,7 @@ def __init__(self):
self.temp_working_dir = None
self.idx_range = (None, None)
self.interactive = False
+ self.sys_msgs_to_hide = []
def new_session_variables(**kwargs):
@@ -422,14 +425,14 @@ def process_prompt(self, prompt, sv, chat_history):
mod_msg = f"This is a {modality} image.\n" if modality != "Unknown" else ""
img_file = CACHED_IMAGES.get(sv.image_url, None)
- sys_msgs_to_hide = []
+
if isinstance(img_file, str):
if "" not in prompt:
_prompt = sv.sys_msg + "" + mod_msg + prompt
- sys_msgs_to_hide.append(sv.sys_msg + "" + mod_msg)
+ sv.sys_msgs_to_hide.append(sv.sys_msg + "" + mod_msg)
else:
_prompt = sv.sys_msg + mod_msg + prompt
- sys_msgs_to_hide.append(sv.sys_msg + mod_msg)
+ sv.sys_msgs_to_hide.append(sv.sys_msg + mod_msg)
if img_file.endswith(".nii.gz"): # Take the specific slice from a volume
chat_history.append(
@@ -502,12 +505,13 @@ def process_prompt(self, prompt, sv, chat_history):
download_file_path=download_pkg,
temp_working_dir=sv.temp_working_dir,
interactive=True,
+ sys_msgs_to_hide=sv.sys_msgs_to_hide,
)
return (
None,
new_sv,
chat_history,
- chat_history.get_html(show_all=False, sys_msgs_to_hide=sys_msgs_to_hide),
+ chat_history.get_html(show_all=False, sys_msgs_to_hide=sv.sys_msgs_to_hide),
chat_history.get_html(show_all=True),
)