sagawa commited on
Commit
1ebb096
1 Parent(s): f3699c7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -25
app.py CHANGED
@@ -100,28 +100,6 @@ def inference_fn(test_loader, model, cfg):
100
 
101
  return np.concatenate(preds)
102
 
103
- def preprocess(df):
104
- """
105
- Preprocess the input DataFrame for training.
106
-
107
- Args:
108
- df (pd.DataFrame): Input DataFrame.
109
- cfg (argparse.Namespace): Configuration object.
110
-
111
- Returns:
112
- pd.DataFrame: Preprocessed DataFrame.
113
- """
114
- df["input"] = (
115
- "REACTANT:"
116
- + df["REACTANT"]
117
- + "REAGENT:"
118
- + df["REAGENT"]
119
- + "PRODUCT:"
120
- + df["PRODUCT"]
121
- )
122
-
123
- return df
124
-
125
 
126
  class TestDataset(Dataset):
127
  """
@@ -203,9 +181,7 @@ if st.button('predict'):
203
  model = ReactionT5Yield.from_pretrained(CFG.model_name_or_path)
204
 
205
  if CFG.uploaded_file is not None:
206
- test_ds = pd.read_csv(CFG.data)
207
- if "input" not in test_ds.columns:
208
- test_ds = preprocess(test_ds)
209
  else:
210
  test_ds = pd.DataFrame.from_dict({"input": [CFG.data]}, orient="index").T
211
 
 
100
 
101
  return np.concatenate(preds)
102
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
103
 
104
  class TestDataset(Dataset):
105
  """
 
181
  model = ReactionT5Yield.from_pretrained(CFG.model_name_or_path)
182
 
183
  if CFG.uploaded_file is not None:
184
+ test_ds = pd.read_csv(CFG.uploaded_file)
 
 
185
  else:
186
  test_ds = pd.DataFrame.from_dict({"input": [CFG.data]}, orient="index").T
187