mirror of
https://github.com/openai/whisper.git
synced 2025-11-24 14:35:57 +00:00
fix
This commit is contained in:
parent
a9c001394a
commit
0390c216d6
@ -302,22 +302,20 @@ def get_writer(
|
|||||||
"json": WriteJSON,
|
"json": WriteJSON,
|
||||||
}
|
}
|
||||||
|
|
||||||
if output_format == "all":
|
|
||||||
all_writers = [writer(output_dir) for writer in writers.values()]
|
|
||||||
|
|
||||||
def write_all(
|
|
||||||
result: dict, file: TextIO, options: Optional[dict] = None, **kwargs
|
|
||||||
):
|
|
||||||
for writer in all_writers:
|
|
||||||
writer(result, file, options, **kwargs)
|
|
||||||
|
|
||||||
return write_all
|
|
||||||
|
|
||||||
writer_funcs = []
|
writer_funcs = []
|
||||||
for format in output_format.split(','):
|
if output_format == "all":
|
||||||
if format in writers:
|
writer_funcs = [writer(output_dir) for writer in writers.values()]
|
||||||
writer_funcs.append(writers[format])
|
else:
|
||||||
else:
|
for format in output_format.split(','):
|
||||||
raise ValueError(f"Output format '{format}' is not supported.")
|
if format in writers:
|
||||||
|
writer_funcs.append(writers[format](output_dir))
|
||||||
|
else:
|
||||||
|
raise ValueError(f"Output format '{format}' is not supported.")
|
||||||
|
|
||||||
return lambda result, file, options: [writer(output_dir)(result, file, options) for writer in writer_funcs]
|
def write_all (
|
||||||
|
result: dict, file: TextIO, options: Optional[dict] = None, **kwargs
|
||||||
|
):
|
||||||
|
for writer in writer_funcs:
|
||||||
|
writer(result, file, options, **kwargs)
|
||||||
|
|
||||||
|
return write_all
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user