lewtun HF staff commited on
Commit
acb47d3
1 Parent(s): 53ae03f

Fix extended datasets

Browse files
Files changed (1) hide show
  1. tagging_app.py +5 -11
tagging_app.py CHANGED
@@ -314,17 +314,16 @@ if "original" in state["source_datasets"]:
314
  pre_select_ext_a += ["original"]
315
  if any([p.startswith("extended") for p in state["source_datasets"]]):
316
  pre_select_ext_a += ["extended"]
317
- state["extended"] = multiselect(
318
  leftcol,
319
  "Relations to existing work",
320
  "Does the dataset contain original data and/or was it extended from other datasets?",
321
  values=pre_select_ext_a,
322
  valid_set=["original", "extended"],
323
  )
324
- state["source_datasets"] = ["original"] if "original" in state["extended"] else []
325
 
326
- if "extended" in state["extended"]:
327
- pre_select_ext_b = [p.split("|")[1] for p in state["source_datasets"] if p.startswith("extended")]
328
  extended_sources = multiselect(
329
  leftcol,
330
  "Linked datasets",
@@ -332,13 +331,8 @@ if "extended" in state["extended"]:
332
  values=pre_select_ext_b,
333
  valid_set=dataset_ids + ["other"],
334
  )
335
- if "other" in extended_sources:
336
- other_extended_sources = leftcol.text_input(
337
- "You selected 'other' dataset. Please enter a short hyphen-separated description:",
338
- value="my-dataset",
339
- )
340
- leftcol.write(f"Registering other-{other_extended_sources} dataset")
341
- extended_sources[extended_sources.index("other")] = f"other-{other_extended_sources}"
342
  state["source_datasets"] += [f"extended|{src}" for src in extended_sources]
343
 
344
 
 
314
  pre_select_ext_a += ["original"]
315
  if any([p.startswith("extended") for p in state["source_datasets"]]):
316
  pre_select_ext_a += ["extended"]
317
+ state["source_datasets"] = multiselect(
318
  leftcol,
319
  "Relations to existing work",
320
  "Does the dataset contain original data and/or was it extended from other datasets?",
321
  values=pre_select_ext_a,
322
  valid_set=["original", "extended"],
323
  )
 
324
 
325
+ if "extended" in state["source_datasets"]:
326
+ pre_select_ext_b = [p.split("|")[1] for p in state["source_datasets"] if p.startswith("extended|")]
327
  extended_sources = multiselect(
328
  leftcol,
329
  "Linked datasets",
 
331
  values=pre_select_ext_b,
332
  valid_set=dataset_ids + ["other"],
333
  )
334
+ # flush placeholder
335
+ state["source_datasets"].remove("extended")
 
 
 
 
 
336
  state["source_datasets"] += [f"extended|{src}" for src in extended_sources]
337
 
338