dodijk commited on
Commit
61ebda9
1 Parent(s): eccc5cd
Files changed (2) hide show
  1. app.py +3 -1
  2. requirements.txt +2 -1
app.py CHANGED
@@ -38,7 +38,7 @@ def move_video_to_tempdir(input_dir, filename):
38
 
39
  def download_video_from_url(url):
40
  """Download video from url or return md5 hash as video name"""
41
- filename = os.path.join(video_directory, hashlib.md5(url.encode()).hexdigest())
42
  if not os.path.exists(filename):
43
  with (urllib.request.urlopen(url)) as f, open(filename, 'wb') as fileout:
44
  fileout.write(f.read())
@@ -87,6 +87,8 @@ def index_hashes_for_video(url, is_file = False):
87
  logging.info(f"Index {filename}.index has in total {binary_index.ntotal} frames")
88
  return binary_index
89
 
 
 
90
  hash_vectors = np.array([x['hash'] for x in compute_hashes(VideoFileClip(filename))])
91
  logging.info(f"Computed hashes for {hash_vectors.shape} frames.")
92
 
 
38
 
39
  def download_video_from_url(url):
40
  """Download video from url or return md5 hash as video name"""
41
+ filename = filename_from_url(url)
42
  if not os.path.exists(filename):
43
  with (urllib.request.urlopen(url)) as f, open(filename, 'wb') as fileout:
44
  fileout.write(f.read())
 
87
  logging.info(f"Index {filename}.index has in total {binary_index.ntotal} frames")
88
  return binary_index
89
 
90
+ download_video_from_url(url)
91
+
92
  hash_vectors = np.array([x['hash'] for x in compute_hashes(VideoFileClip(filename))])
93
  logging.info(f"Computed hashes for {hash_vectors.shape} frames.")
94
 
requirements.txt CHANGED
@@ -4,4 +4,5 @@ imagehash==4.2.1
4
  pandas==1.3.5
5
  faiss-cpu==1.7.2
6
  Pillow==9.2.0
7
- kats==0.2.0
 
 
4
  pandas==1.3.5
5
  faiss-cpu==1.7.2
6
  Pillow==9.2.0
7
+ kats==0.2.0
8
+ seaborn==0.12.0