Diego Fernandez commited on
Commit
00738ec
1 Parent(s): d7061ef

chore: temp directory using tempfile lib

Browse files
Files changed (3) hide show
  1. demo_utils/files.py +0 -10
  2. inference.py +3 -4
  3. tmp/.gitkeep +0 -0
demo_utils/files.py DELETED
@@ -1,10 +0,0 @@
1
- import glob
2
- import os
3
-
4
-
5
- def clean_videos(path: str):
6
- # Remove past videos
7
- files = glob.glob(f"{path}/*")
8
- for file in files:
9
- if file.endswith(".mp4"):
10
- os.remove(file)
 
 
 
 
 
 
 
 
 
 
 
inference.py CHANGED
@@ -1,6 +1,7 @@
1
  import argparse
2
  import glob
3
  import os
 
4
 
5
  import numpy as np
6
  from norfair import AbsolutePaths, Paths, Tracker, Video
@@ -15,7 +16,6 @@ from demo_utils.configuration import (
15
  )
16
  from demo_utils.distance_function import euclidean_distance, iou
17
  from demo_utils.draw import center, draw
18
- from demo_utils.files import clean_videos
19
 
20
 
21
  def inference(
@@ -25,9 +25,8 @@ def inference(
25
  track_points: str,
26
  model_threshold: str,
27
  ):
28
- output_path = "tmp"
29
-
30
- clean_videos(output_path)
31
 
32
  coord_transformations = None
33
  paths_drawer = None
 
1
  import argparse
2
  import glob
3
  import os
4
+ import tempfile
5
 
6
  import numpy as np
7
  from norfair import AbsolutePaths, Paths, Tracker, Video
 
16
  )
17
  from demo_utils.distance_function import euclidean_distance, iou
18
  from demo_utils.draw import center, draw
 
19
 
20
 
21
  def inference(
 
25
  track_points: str,
26
  model_threshold: str,
27
  ):
28
+ temp_dir = tempfile.TemporaryDirectory()
29
+ output_path = temp_dir.name
 
30
 
31
  coord_transformations = None
32
  paths_drawer = None
tmp/.gitkeep DELETED
File without changes