@@ -990,7 +990,7 @@ def upload_reference_dataset(
990990 dataset_config : Optional [Dict [str , any ]] = None ,
991991 dataset_config_file_path : Optional [str ] = None ,
992992 ) -> 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."""
994994 if dataset_config is None and dataset_config_file_path is None :
995995 raise ValueError (
996996 "Either `dataset_config` or `dataset_config_file_path` must be"
@@ -1024,8 +1024,10 @@ def upload_reference_dataset(
10241024
10251025 with tempfile .TemporaryDirectory () as tmp_dir :
10261026 # 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 )
10291031
10301032 tar_file_path = os .path .join (tmp_dir , "tarfile" )
10311033 with tarfile .open (tar_file_path , mode = "w:gz" ) as tar :
@@ -1049,15 +1051,15 @@ def upload_reference_dataframe(
10491051 dataset_config : Optional [Dict [str , any ]] = None ,
10501052 dataset_config_file_path : Optional [str ] = None ,
10511053 ) -> 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."""
10531055 # --------------------------- Resource validations --------------------------- #
10541056 if not isinstance (dataset_df , pd .DataFrame ):
10551057 raise exceptions .OpenlayerValidationError (
10561058 f"- `dataset_df` is a `{ type (dataset_df )} `, but it must be of type"
10571059 " `pd.DataFrame`. \n "
10581060 ) from None
10591061 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" )
10611063 dataset_df .to_csv (file_path , index = False )
10621064 return self .upload_reference_dataset (
10631065 file_path = file_path ,
0 commit comments