Skip to content

Commit 721b435

Browse files
authored
Merge pull request #100 from visual-layer/overwrite
Overwrite
2 parents e1ba8ea + 189475c commit 721b435

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

fastdup/engine.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def run(self,
4343
embeddings=None,
4444
subset: list = None,
4545
data_type: str = 'infer',
46-
overwrite: bool = True,
46+
overwrite: bool = False,
4747
model_path=None,
4848
distance='cosine',
4949
nearest_neighbors_k: int = 2,

fastdup/fastdup_controller.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from pathlib import Path
99
import fastdup
1010
from pandas.errors import EmptyDataError
11-
import shutil
11+
# import shutil
1212
import fastdup.fastup_constants as FD
1313
#import boto3
1414
from fastdup.sentry import v1_sentry_handler
@@ -77,7 +77,8 @@ def _init_run(self, input_dir: Union[str, Path] = None, df_annot: pd.DataFrame =
7777
:param overwrite: overwrite existing fastdup state (delete work_dir)
7878
"""
7979
if overwrite:
80-
shutil.rmtree(self._work_dir, ignore_errors=True)
80+
# quick fix - to prevent users from deleting their data by mistake
81+
# shutil.rmtree(self._work_dir, ignore_errors=True)
8182
self._fastdup_applied = False
8283

8384
# set run mode & data type

fastdup/fastdup_galleries.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,15 @@ def _infer_paths(self, users_input: Union[str, Path], temp_save_path: Union[str,
7373

7474
def _clean_temp_dir(self, save_dir, html_src_path, html_dst_path, lazy_load=False, save_artifacts=False):
7575
if not lazy_load:
76-
shutil.move(html_src_path, html_dst_path)
76+
try:
77+
shutil.move(html_src_path, html_dst_path)
78+
except Exception as e:
79+
# quick fix - prevent error when html file is not generated
80+
pass
7781
if not save_artifacts and not lazy_load:
78-
shutil.rmtree(save_dir)
82+
# quick fix - to prevent users from deleting their data by mistake
83+
# shutil.rmtree(save_dir)
84+
pass
7985

8086
@v1_sentry_handler
8187
def outliers_gallery(self, save_path: str = None, label_col: str = FD.ANNOT_LABEL, draw_bbox: bool = True,

0 commit comments

Comments
 (0)