pass model
This commit is contained in:
parent
98c680e89c
commit
1bfa67ad5d
1 changed files with 4 additions and 3 deletions
|
@ -92,7 +92,7 @@ def prepare_joint_annotations(result, target_length=200):
|
||||||
return annotations
|
return annotations
|
||||||
|
|
||||||
|
|
||||||
def extract_subtitles(item, user, layer, translate, gpu=False, join_sentences=False):
|
def extract_subtitles(item, user, layer, translate, gpu=False, join_sentences=False, model="small"):
|
||||||
language = None
|
language = None
|
||||||
if "language" not in item.data:
|
if "language" not in item.data:
|
||||||
language = None
|
language = None
|
||||||
|
@ -108,6 +108,7 @@ def extract_subtitles(item, user, layer, translate, gpu=False, join_sentences=Fa
|
||||||
|
|
||||||
run_py = os.path.join(os.path.dirname(os.path.abspath(__file__)), "run_whisper.py")
|
run_py = os.path.join(os.path.dirname(os.path.abspath(__file__)), "run_whisper.py")
|
||||||
cmd = ["/opt/whisper-timestamped/bin/python", run_py]
|
cmd = ["/opt/whisper-timestamped/bin/python", run_py]
|
||||||
|
cmd += ["--model", model]
|
||||||
if language:
|
if language:
|
||||||
cmd += ["--language", language]
|
cmd += ["--language", language]
|
||||||
if translate and language in translate:
|
if translate and language in translate:
|
||||||
|
@ -148,7 +149,7 @@ def extract_subtitles(item, user, layer, translate, gpu=False, join_sentences=Fa
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
def extract_subtitles_cmd(item, user, layer, translate, gpu=False):
|
def extract_subtitles_cmd(item, user, layer, translate, gpu=False, model="small"):
|
||||||
if "language" not in item.data:
|
if "language" not in item.data:
|
||||||
language = None
|
language = None
|
||||||
else:
|
else:
|
||||||
|
@ -159,7 +160,7 @@ def extract_subtitles_cmd(item, user, layer, translate, gpu=False):
|
||||||
src = item.streams()[0].media.path
|
src = item.streams()[0].media.path
|
||||||
|
|
||||||
tmp = tempfile.mkdtemp()
|
tmp = tempfile.mkdtemp()
|
||||||
cmd = ["/opt/whisper-timestamped/bin/whisper_timestamped", "--model", "turbo"]
|
cmd = ["/opt/whisper-timestamped/bin/whisper_timestamped", "--model", model]
|
||||||
if language:
|
if language:
|
||||||
cmd += ["--language", language]
|
cmd += ["--language", language]
|
||||||
if translate and language in translate:
|
if translate and language in translate:
|
||||||
|
|
Loading…
Add table
Reference in a new issue