in
PYL-R1714 48 """
49 pil_img = Image.fromarray(image)
50 bands = pil_img.getbands()
51 if bands == ("R", "G", "B") or bands == ("R", "G", "B", "A"): 52 thumb = pil_img.resize((thumb_size, thumb_size))
53 SSE, bias = 0, [0, 0, 0]
54 if adjust_color_bias:
864 for chunk in tqdm(chunks, desc="Processing Chunks"):
865 if chunk.endswith(".wav"):
866 chunk_path = Path(chunk_dir) / chunk
867 if method == "deepspeech" or method == "vosk":868 if model_dir is None:
869 raise AssertionError
870 model = load_model(method, model_dir)
75
76 # Perform argument checks
77 if (
78 params.transcription_method == "deepspeech" 79 or params.transcription_method == "vosk"
80 ) and params.transcribe_model_dir is None:
81 logger.error(
31 if output_path.suffix == "":
32 output_path = output_path.with_suffix(".vtt")
33 sub_format = "vtt"
34 elif output_path.suffix != ".srt" and output_path.suffix != ".vtt": 35 raise Exception(
36 "Only .srt and .vtt files are supported. You tried to create a "
37 + output_path.suffix
86 enabled_checks = [
87 x
88 for x in enabled_checks
89 if x != "large_stroke_width" and x != "large_height" 90 ]
91
92 # Start by selecting the first block and first paragraph in that block
To check if a variable is equal to one of many values, combine the values into a tuple and check if the variable is contained in
it instead of checking for equality against each of the values.
This is faster, less verbose, and more readable.
if x == 1 or x == 2 or x == 3:
do_something()
if x in (1, 2, 3):
do_something()