mirror of
https://github.com/openai/whisper.git
synced 2025-11-24 06:26:03 +00:00
fix
This commit is contained in:
parent
a9c001394a
commit
0390c216d6
@ -302,22 +302,20 @@ def get_writer(
|
||||
"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 = []
|
||||
if output_format == "all":
|
||||
writer_funcs = [writer(output_dir) for writer in writers.values()]
|
||||
else:
|
||||
for format in output_format.split(','):
|
||||
if format in writers:
|
||||
writer_funcs.append(writers[format])
|
||||
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