select model
This commit is contained in:
parent
4853d9bfb7
commit
7f11a62243
1 changed files with 6 additions and 4 deletions
|
@ -6,8 +6,9 @@ import sys
|
|||
import whisper_timestamped as whisper
|
||||
|
||||
|
||||
def transcribe(path, language=None, translate=None):
|
||||
model = whisper.load_model("large-v3-turbo")
|
||||
def transcribe(path, language=None, translate=None, model="small"):
|
||||
#model = whisper.load_model("large-v3-turbo")
|
||||
model = whisper.load_model(model)
|
||||
audio = whisper.load_audio(path)
|
||||
if translate:
|
||||
task = "translate"
|
||||
|
@ -33,10 +34,11 @@ if __name__ == "__main__":
|
|||
usage = "usage: %(prog)s [options] path output"
|
||||
parser = ArgumentParser(usage=usage, prog="run_whisper")
|
||||
parser.add_argument("-l", "--language", dest="language", default=None)
|
||||
parser.add_argument("-t", "--translate", dest="translate", default=None)
|
||||
parser.add_argument("-m", "--model", dest="model", default="small")
|
||||
parser.add_argument("-t", "--translate", dest="translate", action='store_true', default=False)
|
||||
parser.add_argument("path", metavar="path", type=str, help="media input")
|
||||
parser.add_argument("output", metavar="output", type=str, help="json output")
|
||||
opts = parser.parse_args()
|
||||
result = transcribe(opts.path, opts.language, opts.translate)
|
||||
result = transcribe(opts.path, opts.language, opts.translate, opts.model)
|
||||
with open(opts.output, "w") as fd:
|
||||
json.dump(result, fd, indent=2, ensure_ascii=False)
|
||||
|
|
Loading…
Reference in a new issue