richiam commited on
Commit
160d8b1
·
verified ·
1 Parent(s): 1ff84c4

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +15 -8
app.py CHANGED
@@ -106,17 +106,25 @@ def scan_grid():
106
  m = re.match(r"t=([\d.]+)_ALL_FIELDS\.csv", fname)
107
  if m:
108
  thresholds.add(m.group(1))
109
- # Discover fields from a sample ALL_FIELDS file
110
- sample = next(iter(
 
 
 
 
 
111
  glob.glob(os.path.join(GRID_BASE, "model=*", "min=*", "t=*_ALL_FIELDS.csv.gz")) +
112
  glob.glob(os.path.join(GRID_BASE, "model=*", "min=*", "t=*_ALL_FIELDS.csv"))
113
- ), None)
114
- if sample:
115
  try:
116
- ext = ".gz" if sample.endswith(".gz") else None
117
- fields = set(pd.read_csv(sample, compression="gzip" if ext else None, usecols=["field"])["field"].unique())
 
 
118
  except Exception:
119
- pass
 
 
120
  return (
121
  sorted(models),
122
  sorted(mins, key=float),
@@ -2347,7 +2355,6 @@ def download_csv(_, table_data):
2347
  @app.callback(
2348
  Output("eval-classif-graph", "figure"),
2349
  Input("classif-group", "value"),
2350
- prevent_initial_call=True,
2351
  )
2352
  def update_classif_chart(group):
2353
  if CLASSIF_DF.empty or not group:
 
106
  m = re.match(r"t=([\d.]+)_ALL_FIELDS\.csv", fname)
107
  if m:
108
  thresholds.add(m.group(1))
109
+ # Discover fields from sample ALL_FIELDS files — try until one succeeds
110
+ _FALLBACK_FIELDS = [
111
+ "desalting_process", "elution_buffer", "enzyme_name", "expression_strain",
112
+ "inducer", "induction_temperature", "lysis_buffer", "medium_name",
113
+ "molecular_weight", "organism_source", "plasmid", "source_key", "strain",
114
+ ]
115
+ for sample in (
116
  glob.glob(os.path.join(GRID_BASE, "model=*", "min=*", "t=*_ALL_FIELDS.csv.gz")) +
117
  glob.glob(os.path.join(GRID_BASE, "model=*", "min=*", "t=*_ALL_FIELDS.csv"))
118
+ ):
 
119
  try:
120
+ compression = "gzip" if sample.endswith(".gz") else None
121
+ fields = set(pd.read_csv(sample, compression=compression, usecols=["field"])["field"].unique())
122
+ if fields:
123
+ break
124
  except Exception:
125
+ continue
126
+ if not fields:
127
+ fields = set(_FALLBACK_FIELDS)
128
  return (
129
  sorted(models),
130
  sorted(mins, key=float),
 
2355
  @app.callback(
2356
  Output("eval-classif-graph", "figure"),
2357
  Input("classif-group", "value"),
 
2358
  )
2359
  def update_classif_chart(group):
2360
  if CLASSIF_DF.empty or not group: