From 4a384f57b6f4daa41861162898415fa981dc73e0 Mon Sep 17 00:00:00 2001 From: Snehil Shah Date: Thu, 8 Aug 2024 17:03:18 +0530 Subject: [PATCH] chore: remove the file after the operation has ended Signed-off-by: Snehil Shah --- src/core/operators/vid_vec_rep_clip.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/core/operators/vid_vec_rep_clip.py b/src/core/operators/vid_vec_rep_clip.py index 14190d1..e443d2c 100644 --- a/src/core/operators/vid_vec_rep_clip.py +++ b/src/core/operators/vid_vec_rep_clip.py @@ -10,6 +10,7 @@ def initialize(param): param (dict): Parameters for initialization """ print("Installing packages for vid_vec_rep_clip") + global os global VideoAnalyzer, gendata # Imports @@ -147,8 +148,11 @@ def run(file): generator: Yields video and I-frame vector representations """ fname = file["path"] - vid_analyzer = VideoAnalyzer(fname) - return gendata(vid_analyzer) + try: + vid_analyzer = VideoAnalyzer(fname) + return gendata(vid_analyzer) + finally: + os.remove(fname) def cleanup(param): pass