Samuel Mueller commited on
Commit
fc8530b
1 Parent(s): e3f4b64

removed y_attribute as output of compute

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -13,7 +13,7 @@ from sklearn.model_selection import cross_val_score
13
 
14
  def compute(file, y_attribute, cv_folds):
15
  if file is None:
16
- return 'Please upload a .arff file', y_attribute
17
  if file.name.endswith('.arff'):
18
  dataset = openml.datasets.OpenMLDataset('t', 'test', data_file=file.name)
19
  X_, _, categorical_indicator_, attribute_names_ = dataset.get_data(
@@ -23,7 +23,7 @@ def compute(file, y_attribute, cv_folds):
23
  X, y, categorical_indicator_, attribute_names_ = dataset.get_data(
24
  dataset_format="array", target=y_attribute)
25
  else:
26
- return 'Please upload a .arff file', y_attribute
27
 
28
  order = np.arange(y.shape[0])
29
  np.random.seed(13)
@@ -40,7 +40,7 @@ def compute(file, y_attribute, cv_folds):
40
  # print(file, type(file))
41
  return f"ROC AUC OVO Cross Val mean is {sum(scores) / len(scores)} from {scores}. " + (
42
  "The PFN is only trained for datasets with up to 1024 training examples and it had to extrapolate to greater datasets for this evaluation." if len(
43
- y) // cv_folds > 1024 else ""), y_attribute
44
 
45
 
46
  def upload_file(file):
@@ -76,6 +76,6 @@ with gr.Blocks() as demo:
76
  # out_table = gr.DataFrame()
77
  inp_file.change(fn=upload_file, inputs=inp_file, outputs=[out_text, y_attribute])
78
 
79
- btn.click(fn=compute, inputs=[inp_file, y_attribute, cv_folds], outputs=[out_text, y_attribute])
80
 
81
  demo.launch()
13
 
14
  def compute(file, y_attribute, cv_folds):
15
  if file is None:
16
+ return 'Please upload a .arff file'
17
  if file.name.endswith('.arff'):
18
  dataset = openml.datasets.OpenMLDataset('t', 'test', data_file=file.name)
19
  X_, _, categorical_indicator_, attribute_names_ = dataset.get_data(
23
  X, y, categorical_indicator_, attribute_names_ = dataset.get_data(
24
  dataset_format="array", target=y_attribute)
25
  else:
26
+ return 'Please upload a .arff file'
27
 
28
  order = np.arange(y.shape[0])
29
  np.random.seed(13)
40
  # print(file, type(file))
41
  return f"ROC AUC OVO Cross Val mean is {sum(scores) / len(scores)} from {scores}. " + (
42
  "The PFN is only trained for datasets with up to 1024 training examples and it had to extrapolate to greater datasets for this evaluation." if len(
43
+ y) // cv_folds > 1024 else "")
44
 
45
 
46
  def upload_file(file):
76
  # out_table = gr.DataFrame()
77
  inp_file.change(fn=upload_file, inputs=inp_file, outputs=[out_text, y_attribute])
78
 
79
+ btn.click(fn=compute, inputs=[inp_file, y_attribute, cv_folds], outputs=[out_text])
80
 
81
  demo.launch()