Raphael commited on
Commit
82c5e0a
1 Parent(s): 7d79fa6

No temp directory anymore

Browse files

Signed-off-by: Raphael <oOraph@users.noreply.github.com>

Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -2,7 +2,6 @@ import logging
2
  import math
3
  import os
4
  import shutil
5
- import tempfile
6
  import time
7
 
8
  from datasets import load_dataset
@@ -21,6 +20,8 @@ os.environ['HF_HUB_ENABLE_HF_TRANSFER'] = '1'
21
  logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', force=True)
22
 
23
  LOG = logging.getLogger(__name__)
 
 
24
  CLIP_SECONDS = 20
25
  SLICES = 4
26
  # SLICE_DURATION = CLIP_SECONDS / SLICES
@@ -64,7 +65,7 @@ summarizer = pipeline(**summarizer_kwargs)
64
 
65
  def demo(url: str, translate: bool):
66
  # Free disk space leak
67
- basedir = tempfile.mkdtemp()
68
  LOG.info("Base directory %s", basedir)
69
  video_path, video = download(url, os.path.join(basedir, 'video.mp4'))
70
  audio_clips(video, basedir)
 
2
  import math
3
  import os
4
  import shutil
 
5
  import time
6
 
7
  from datasets import load_dataset
 
20
  logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', force=True)
21
 
22
  LOG = logging.getLogger(__name__)
23
+ BASEDIR = '/tmp/demo'
24
+ os.makedirs(BASEDIR, exist_ok=True)
25
  CLIP_SECONDS = 20
26
  SLICES = 4
27
  # SLICE_DURATION = CLIP_SECONDS / SLICES
 
65
 
66
  def demo(url: str, translate: bool):
67
  # Free disk space leak
68
+ basedir = BASEDIR
69
  LOG.info("Base directory %s", basedir)
70
  video_path, video = download(url, os.path.join(basedir, 'video.mp4'))
71
  audio_clips(video, basedir)