File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -48,14 +48,17 @@ def run_from_cli(self):
48
48
49
49
def batch (self , dataset_path : str , output_dir : str ):
50
50
# Load the dataset into a pandas DataFrame
51
+ fmt = dataset_path .split ("." )[- 1 ]
51
52
if dataset_path .endswith (".csv" ):
52
53
df = pd .read_csv (dataset_path )
53
54
elif dataset_path .endswith (".json" ):
54
55
df = pd .read_json (dataset_path , orient = "records" )
56
+ else :
57
+ raise ValueError ("Unsupported format. Please choose 'csv' or 'json'." )
55
58
56
59
# Call the model's run_batch method, passing in the DataFrame
57
60
output_df , config = self .run_batch_from_df (df )
58
- self .write_output_to_directory (output_df , config , output_dir )
61
+ self .write_output_to_directory (output_df , config , output_dir , fmt = fmt )
59
62
60
63
def run_batch_from_df (self , df : pd .DataFrame ) -> Tuple [pd .DataFrame , dict ]:
61
64
"""Function that runs the model and returns the result."""
You can’t perform that action at this time.
0 commit comments