Raphael
commited on
isolate requests in their directory
Browse filesSigned-off-by: Raphael <[email protected]>
app.py
CHANGED
@@ -2,6 +2,7 @@ import logging
|
|
2 |
import math
|
3 |
import os
|
4 |
import shutil
|
|
|
5 |
import time
|
6 |
|
7 |
from datasets import load_dataset
|
@@ -24,9 +25,6 @@ SLICES = 4
|
|
24 |
SLICE_DURATION = CLIP_SECONDS / SLICES
|
25 |
# At most 6 mins
|
26 |
MAX_CHUNKS = 45
|
27 |
-
BASEDIR = '/tmp/processed'
|
28 |
-
|
29 |
-
os.makedirs(BASEDIR, exist_ok=True)
|
30 |
|
31 |
asr_kwargs = {
|
32 |
"task": "automatic-speech-recognition",
|
@@ -63,7 +61,9 @@ summarizer = pipeline(**summarizer_kwargs)
|
|
63 |
|
64 |
|
65 |
def demo(url: str, translate: bool):
|
66 |
-
|
|
|
|
|
67 |
video_path, video = download(url, os.path.join(basedir, 'video.mp4'))
|
68 |
audio_clips(video, basedir)
|
69 |
srt_file, summary = process_video(basedir, video.duration, translate)
|
|
|
2 |
import math
|
3 |
import os
|
4 |
import shutil
|
5 |
+
import tempfile
|
6 |
import time
|
7 |
|
8 |
from datasets import load_dataset
|
|
|
25 |
SLICE_DURATION = CLIP_SECONDS / SLICES
|
26 |
# At most 6 mins
|
27 |
MAX_CHUNKS = 45
|
|
|
|
|
|
|
28 |
|
29 |
asr_kwargs = {
|
30 |
"task": "automatic-speech-recognition",
|
|
|
61 |
|
62 |
|
63 |
def demo(url: str, translate: bool):
|
64 |
+
# Free disk space leak
|
65 |
+
basedir = tempfile.mkdtemp()
|
66 |
+
LOG.info("Base directory %s", basedir)
|
67 |
video_path, video = download(url, os.path.join(basedir, 'video.mp4'))
|
68 |
audio_clips(video, basedir)
|
69 |
srt_file, summary = process_video(basedir, video.duration, translate)
|