@@ -32,32 +32,29 @@ def run_from_cli(self):
32
32
"--dataset-path" , type = str , required = True , help = "Path to the dataset"
33
33
)
34
34
parser .add_argument (
35
- "--dataset-name" , type = str , required = True , help = "Name of the dataset"
36
- )
37
- parser .add_argument (
38
- "--output-path" ,
35
+ "--output-dir" ,
39
36
type = str ,
40
37
required = False ,
41
- help = "Path to dump the results" ,
42
- default = "output" ,
38
+ help = "Directory to dump the results in" ,
43
39
)
44
40
45
41
# Parse the arguments
46
42
args = parser .parse_args ()
47
43
48
44
return self .batch (
49
45
dataset_path = args .dataset_path ,
50
- dataset_name = args .dataset_name ,
51
- output_dir = args .output_path ,
46
+ output_dir = args .output_dir ,
52
47
)
53
48
54
- def batch (self , dataset_path : str , dataset_name : str , output_dir : str ):
49
+ def batch (self , dataset_path : str , output_dir : str ):
55
50
# Load the dataset into a pandas DataFrame
56
- df = pd .read_json (dataset_path , orient = "records" )
51
+ if dataset_path .endswith (".csv" ):
52
+ df = pd .read_csv (dataset_path )
53
+ elif dataset_path .endswith (".json" ):
54
+ df = pd .read_json (dataset_path , orient = "records" )
57
55
58
56
# Call the model's run_batch method, passing in the DataFrame
59
57
output_df , config = self .run_batch_from_df (df )
60
- output_dir = os .path .join (output_dir , dataset_name )
61
58
self .write_output_to_directory (output_df , config , output_dir )
62
59
63
60
def run_batch_from_df (self , df : pd .DataFrame ) -> Tuple [pd .DataFrame , dict ]:
0 commit comments