scdrand23 commited on
Commit
f0eb205
·
1 Parent(s): eadc7f1

hard target matching removed from check_mask_stats

Browse files
Files changed (1) hide show
  1. app.py +24 -1
app.py CHANGED
@@ -137,6 +137,21 @@ IMAGE_INFERENCE_MODES = [
137
  "BIOMED SEGMENTATION + DETECTION + RECOGNITION"
138
  ]
139
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
140
 
141
  def on_mode_dropdown_change(selected_mode):
142
  if selected_mode in IMAGE_INFERENCE_MODES:
@@ -176,6 +191,11 @@ def initialize_model():
176
 
177
  model = initialize_model()
178
 
 
 
 
 
 
179
 
180
  # Utility functions
181
  @spaces.GPU
@@ -250,7 +270,10 @@ with gr.Blocks() as demo:
250
  interactive=False,
251
  show_label=True
252
  )
253
-
 
 
 
254
  # Add error handling for the submit button
255
  submit_btn.click(
256
  fn=process_image,
 
137
  "BIOMED SEGMENTATION + DETECTION + RECOGNITION"
138
  ]
139
 
140
+ MODALITY_PROMPTS = {
141
+ "CT-Abdomen": ["postcava", "aorta", "right kidney", "kidney", "left kidney", "duodenum", "pancreas", "liver", "spleen", "stomach", "gallbladder", "left adrenal gland", "adrenal gland", "right adrenal gland", "esophagus"],
142
+ "CT-Chest": ["nodule", "COVID-19 infection", "tumor"],
143
+ "MRI-Abdomen": ["aorta", "postcava", "right kidney", "duodenum", "kidney", "left kidney", "liver", "pancreas", "gallbladder", "stomach", "spleen", "left adrenal gland", "adrenal gland", "right adrenal gland", "esophagus"],
144
+ "MRI-Cardiac": ["left heart ventricle", "myocardium", "right heart ventricle"],
145
+ "MRI-FLAIR-Brain": ["edema", "tumor core", "whole tumor"],
146
+ "MRI-T1-Gd-Brain": ["enhancing tumor", "non-enhancing tumor", "tumor core"],
147
+ "Pathology": ["connective tissue cells", "inflammatory cells", "neoplastic cells", "epithelial cells"],
148
+ "X-Ray-Chest": ["left lung", "lung", "right lung"],
149
+ "Ultrasound-Cardiac": ["left heart atrium", "left heart ventricle"],
150
+ "Endoscopy": ["neoplastic polyp", "polyp", "non-neoplastic polyp"],
151
+ "Fundus": ["optic cup", "optic disc"],
152
+ "Dermoscopy": ["lesion", "melanoma"],
153
+ "OCT": ["edema"] }
154
+
155
 
156
  def on_mode_dropdown_change(selected_mode):
157
  if selected_mode in IMAGE_INFERENCE_MODES:
 
191
 
192
  model = initialize_model()
193
 
194
+ def update_example_prompts(modality):
195
+ if modality in MODALITY_PROMPTS:
196
+ examples = MODALITY_PROMPTS[modality]
197
+ return f"Example prompts for {modality}:\n" + ", ".join(examples)
198
+ return ""
199
 
200
  # Utility functions
201
  @spaces.GPU
 
270
  interactive=False,
271
  show_label=True
272
  )
273
+ with gr.Accordion("Example Prompts by Modality", open=False):
274
+ for modality, prompts in MODALITY_PROMPTS.items():
275
+ prompt_str = ", ".join(prompts)
276
+ gr.Markdown(f"**{modality}**: {prompt_str}")
277
  # Add error handling for the submit button
278
  submit_btn.click(
279
  fn=process_image,