@@ -990,7 +990,7 @@ def upload_reference_dataset(
990
990
dataset_config : Optional [Dict [str , any ]] = None ,
991
991
dataset_config_file_path : Optional [str ] = None ,
992
992
) -> None :
993
- r """Uploads a reference dataset saved as a csv file to an inference pipeline."""
993
+ """Uploads a reference dataset saved as a csv file to an inference pipeline."""
994
994
if dataset_config is None and dataset_config_file_path is None :
995
995
raise ValueError (
996
996
"Either `dataset_config` or `dataset_config_file_path` must be"
@@ -1024,8 +1024,10 @@ def upload_reference_dataset(
1024
1024
1025
1025
with tempfile .TemporaryDirectory () as tmp_dir :
1026
1026
# Copy relevant files to tmp dir
1027
- utils .write_yaml (dataset_data , f"{ tmp_dir } /dataset_config.yaml" )
1028
- shutil .copy (file_path , tmp_dir )
1027
+ folder_path = os .path .join (tmp_dir , "reference" )
1028
+ os .mkdir (folder_path )
1029
+ utils .write_yaml (dataset_data , f"{ folder_path } /dataset_config.yaml" )
1030
+ shutil .copy (file_path , folder_path )
1029
1031
1030
1032
tar_file_path = os .path .join (tmp_dir , "tarfile" )
1031
1033
with tarfile .open (tar_file_path , mode = "w:gz" ) as tar :
@@ -1049,15 +1051,15 @@ def upload_reference_dataframe(
1049
1051
dataset_config : Optional [Dict [str , any ]] = None ,
1050
1052
dataset_config_file_path : Optional [str ] = None ,
1051
1053
) -> None :
1052
- r """Uploads a reference dataset (a pandas dataframe) to an inference pipeline."""
1054
+ """Uploads a reference dataset (a pandas dataframe) to an inference pipeline."""
1053
1055
# --------------------------- Resource validations --------------------------- #
1054
1056
if not isinstance (dataset_df , pd .DataFrame ):
1055
1057
raise exceptions .OpenlayerValidationError (
1056
1058
f"- `dataset_df` is a `{ type (dataset_df )} `, but it must be of type"
1057
1059
" `pd.DataFrame`. \n "
1058
1060
) from None
1059
1061
with tempfile .TemporaryDirectory () as tmp_dir :
1060
- file_path = os .path .join (tmp_dir , str ( uuid . uuid1 ()) )
1062
+ file_path = os .path .join (tmp_dir , "dataset.csv" )
1061
1063
dataset_df .to_csv (file_path , index = False )
1062
1064
return self .upload_reference_dataset (
1063
1065
file_path = file_path ,
0 commit comments