raylim commited on
Commit
ac41c6b
·
unverified ·
1 Parent(s): 0d1b788

Enforce required sex parameter in Gradio CLI app

Browse files

- Remove 'Unknown' as default sex value
- Add validation to ensure sex is provided for single slide processing
- Update help text to indicate sex is required parameter
- Remove fallback to 'Unknown' when sex is missing

Files changed (1) hide show
  1. src/mosaic/gradio_app.py +5 -3
src/mosaic/gradio_app.py CHANGED
@@ -140,8 +140,8 @@ def main():
140
  "--sex",
141
  type=str,
142
  choices=SEX_OPTIONS,
143
- default="Unknown",
144
- help="Sex of the patient (for single slide processing)",
145
  )
146
  parser.add_argument(
147
  "--tissue-site",
@@ -231,6 +231,8 @@ def main():
231
  # Single slide processing mode
232
  if not args.output_dir:
233
  raise ValueError("Please provide --output-dir to save results")
 
 
234
  settings_df = pd.DataFrame(
235
  [
236
  [
@@ -320,7 +322,7 @@ def main():
320
  slide_path=slide_path,
321
  seg_config=row["Segmentation Config"],
322
  site_type=row["Site Type"],
323
- sex=row.get("Sex", "Unknown"),
324
  tissue_site=row.get("Tissue Site", "Unknown"),
325
  cancer_subtype=row["Cancer Subtype"],
326
  cancer_subtype_name_map=cancer_subtype_name_map,
 
140
  "--sex",
141
  type=str,
142
  choices=SEX_OPTIONS,
143
+ default=None,
144
+ help="Sex of the patient (required for single slide processing)",
145
  )
146
  parser.add_argument(
147
  "--tissue-site",
 
231
  # Single slide processing mode
232
  if not args.output_dir:
233
  raise ValueError("Please provide --output-dir to save results")
234
+ if not args.sex:
235
+ raise ValueError("Please provide --sex (Male or Female) for single slide processing")
236
  settings_df = pd.DataFrame(
237
  [
238
  [
 
322
  slide_path=slide_path,
323
  seg_config=row["Segmentation Config"],
324
  site_type=row["Site Type"],
325
+ sex=row["Sex"],
326
  tissue_site=row.get("Tissue Site", "Unknown"),
327
  cancer_subtype=row["Cancer Subtype"],
328
  cancer_subtype_name_map=cancer_subtype_name_map,