This commit is contained in:
Yuta Hayashibe 2022-10-06 20:31:19 +09:00
parent 5f777d69f7
commit 7c20da4793
3 changed files with 7 additions and 4 deletions

View file

@ -16,7 +16,7 @@ from whisper.audio import N_FRAMES, SAMPLE_RATE
from whisper.tokenizer import LANGUAGES, TO_LANGUAGE_CODE
from whispering.pbar import ProgressBar
from whispering.schema import Context, WhisperConfig, StdoutWriter
from whispering.schema import Context, StdoutWriter, WhisperConfig
from whispering.serve import serve_with_websocket
from whispering.transcriber import WhisperStreamingTranscriber
from whispering.websocket_client import run_websocket_client
@ -106,7 +106,8 @@ def get_opts() -> argparse.Namespace:
"--language",
type=str,
default=None,
choices=["multilanguage"] + sorted(LANGUAGES.keys())
choices=["multilanguage"]
+ sorted(LANGUAGES.keys())
+ sorted([k.title() for k in TO_LANGUAGE_CODE.keys()]),
)
group_model.add_argument(

View file

@ -18,6 +18,7 @@ async def serve_with_websocket_main(websocket):
global g_wsp
idx: int = 0
ctx: Optional[Context] = None
while True:
logger.debug(f"Audio #: {idx}")
try:
@ -77,7 +78,7 @@ async def serve_with_websocket(
serve_with_websocket_main,
host=host,
port=port,
max_size=999999999
max_size=999999999,
):
await asyncio.Future()
except KeyboardInterrupt:

View file

@ -49,7 +49,7 @@ class WhisperStreamingTranscriber:
task="transcribe",
)
# Mulilanguage transcripts
else:
else:
self.tokenizer = get_tokenizer(
self.model.is_multilingual,
task="transcribe",
@ -132,6 +132,7 @@ class WhisperStreamingTranscriber:
_decode_options,
) # type: ignore
assert decode_result is not None
needs_fallback: bool = False
if (
ctx.compression_ratio_threshold is not None