jiawei-ren commited on
Commit
a36eee8
·
1 Parent(s): 892a4c2
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -237,7 +237,7 @@ def clean_up_logs():
237
  os.remove(f)
238
 
239
 
240
- def run(num1, num2, num3, num4, num5, random_seed, submit):
241
  sel_num = [num1, num2, num3, num4, num5]
242
  sel_num = [int(num / 100 * NUM_PER_BUCKET) for num in sel_num]
243
  torch.manual_seed(int(random_seed))
@@ -246,18 +246,18 @@ def run(num1, num2, num3, num4, num5, random_seed, submit):
246
  training_df = make_dataframe(all_x, all_y)
247
 
248
  clean_up_logs()
249
- if submit == 0:
250
  visualize(training_df, df_oracle, 'training_data.png')
251
- if submit == 1:
252
  regress(train_loader, training_df)
253
  make_video()
254
- if submit == 0:
255
  text = "Press \"Start Regressing\" if your are happy with the training data. Regression takes ~10s."
256
  else:
257
  text = "Press \"Prepare Training Data\" before moving the sliders. You may also change the random seed."
258
- training_data_plot = 'training_data.png' if submit == 0 else None
259
- output = 'regression_result.png'.format(NUM_EPOCHS) if submit == 1 else None
260
- video = "movie.mp4" if submit == 1 else None
261
  return training_data_plot, output, video, text
262
 
263
 
 
237
  os.remove(f)
238
 
239
 
240
+ def run(num1, num2, num3, num4, num5, random_seed, mode):
241
  sel_num = [num1, num2, num3, num4, num5]
242
  sel_num = [int(num / 100 * NUM_PER_BUCKET) for num in sel_num]
243
  torch.manual_seed(int(random_seed))
 
246
  training_df = make_dataframe(all_x, all_y)
247
 
248
  clean_up_logs()
249
+ if mode == 0:
250
  visualize(training_df, df_oracle, 'training_data.png')
251
+ if mode == 1:
252
  regress(train_loader, training_df)
253
  make_video()
254
+ if mode == 0:
255
  text = "Press \"Start Regressing\" if your are happy with the training data. Regression takes ~10s."
256
  else:
257
  text = "Press \"Prepare Training Data\" before moving the sliders. You may also change the random seed."
258
+ training_data_plot = 'training_data.png' if mode == 0 else None
259
+ output = 'regression_result.png'.format(NUM_EPOCHS) if mode == 1 else None
260
+ video = "movie.mp4" if mode == 1 else None
261
  return training_data_plot, output, video, text
262
 
263