other parts write to stdout, write output to tmp file
This commit is contained in:
parent
f6a1d168ee
commit
ecf5effc83
2 changed files with 13 additions and 6 deletions
|
|
@ -30,11 +30,13 @@ def transcribe(path, language=None, translate=None):
|
|||
|
||||
|
||||
if __name__ == "__main__":
|
||||
usage = "usage: %(prog)s [options] path"
|
||||
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("path", metavar="path", type=str, help="media")
|
||||
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)
|
||||
print(json.dumps(result, indent=2, ensure_ascii=False))
|
||||
with open(opts.output, "w") as fd:
|
||||
json.dump(result, fd, indent=2, ensure_ascii=False)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue