LAP-DEV commited on
Commit
61022d8
·
verified ·
1 Parent(s): dd225c8

Delete app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -403
app.py DELETED
@@ -1,403 +0,0 @@
1
- import os
2
- import argparse
3
- import gradio as gr
4
- import yaml
5
-
6
- from modules.utils.paths import (FASTER_WHISPER_MODELS_DIR, DIARIZATION_MODELS_DIR, OUTPUT_DIR, WHISPER_MODELS_DIR,
7
- INSANELY_FAST_WHISPER_MODELS_DIR, NLLB_MODELS_DIR, DEFAULT_PARAMETERS_CONFIG_PATH,
8
- UVR_MODELS_DIR)
9
- from modules.utils.files_manager import load_yaml
10
- from modules.whisper.whisper_factory import WhisperFactory
11
- from modules.whisper.faster_whisper_inference import FasterWhisperInference
12
- from modules.whisper.insanely_fast_whisper_inference import InsanelyFastWhisperInference
13
- from modules.translation.nllb_inference import NLLBInference
14
- from modules.ui.htmls import *
15
- from modules.utils.cli_manager import str2bool
16
- from modules.utils.youtube_manager import get_ytmetas
17
- from modules.translation.deepl_api import DeepLAPI
18
- from modules.whisper.whisper_parameter import *
19
-
20
- ### Device info ###
21
- import torch
22
- import torchaudio
23
- import torch.cuda as cuda
24
- import platform
25
- from transformers import __version__ as transformers_version
26
-
27
- device = "cuda" if torch.cuda.is_available() else "cpu"
28
- num_gpus = cuda.device_count() if torch.cuda.is_available() else 0
29
- cuda_version = torch.version.cuda if torch.cuda.is_available() else "N/A"
30
- cudnn_version = torch.backends.cudnn.version() if torch.cuda.is_available() else "N/A"
31
- os_info = platform.system() + " " + platform.release() + " " + platform.machine()
32
-
33
- # Get the available VRAM for each GPU (if available)
34
- vram_info = []
35
- if torch.cuda.is_available():
36
- for i in range(cuda.device_count()):
37
- gpu_properties = cuda.get_device_properties(i)
38
- vram_info.append(f"**GPU {i}: {gpu_properties.total_memory / 1024**3:.2f} GB**")
39
-
40
- pytorch_version = torch.__version__
41
- torchaudio_version = torchaudio.__version__ if 'torchaudio' in dir() else "N/A"
42
-
43
- device_info = f"""Running on: **{device}**
44
-
45
- Number of GPUs available: **{num_gpus}**
46
-
47
- CUDA version: **{cuda_version}**
48
-
49
- CuDNN version: **{cudnn_version}**
50
-
51
- PyTorch version: **{pytorch_version}**
52
-
53
- Torchaudio version: **{torchaudio_version}**
54
-
55
- Transformers version: **{transformers_version}**
56
-
57
- Operating system: **{os_info}**
58
-
59
- Available VRAM:
60
- \t {', '.join(vram_info) if vram_info else '**N/A**'}
61
- """
62
- ### End Device info ###
63
-
64
- class App:
65
- def __init__(self, args):
66
- self.args = args
67
- #self.app = gr.Blocks(css=CSS, theme=self.args.theme, delete_cache=(60, 3600))
68
- self.app = gr.Blocks(css=CSS,theme=gr.themes.Ocean(), title="Automatic speech recognition", delete_cache=(60, 3600))
69
- self.whisper_inf = WhisperFactory.create_whisper_inference(
70
- whisper_type=self.args.whisper_type,
71
- whisper_model_dir=self.args.whisper_model_dir,
72
- faster_whisper_model_dir=self.args.faster_whisper_model_dir,
73
- insanely_fast_whisper_model_dir=self.args.insanely_fast_whisper_model_dir,
74
- uvr_model_dir=self.args.uvr_model_dir,
75
- output_dir=self.args.output_dir,
76
- )
77
- self.nllb_inf = NLLBInference(
78
- model_dir=self.args.nllb_model_dir,
79
- output_dir=os.path.join(self.args.output_dir, "translations")
80
- )
81
- self.deepl_api = DeepLAPI(
82
- output_dir=os.path.join(self.args.output_dir, "translations")
83
- )
84
- self.default_params = load_yaml(DEFAULT_PARAMETERS_CONFIG_PATH)
85
- print(f"Use \"{self.args.whisper_type}\" implementation")
86
- print(f"Device \"{self.whisper_inf.device}\" is detected")
87
-
88
- def create_whisper_parameters(self):
89
-
90
- whisper_params = self.default_params["whisper"]
91
- diarization_params = self.default_params["diarization"]
92
- vad_params = self.default_params["vad"]
93
- uvr_params = self.default_params["bgm_separation"]
94
-
95
- #Translation integration
96
- translation_params = self.default_params["translation"]
97
- nllb_params = translation_params["nllb"]
98
-
99
- with gr.Row():
100
- with gr.Column(scale=4):
101
- with gr.Row():
102
- dd_model = gr.Dropdown(choices=self.whisper_inf.available_models, value=whisper_params["model_size"],label="Model", info="Larger models increase transcription quality, but reduce performance", interactive=True)
103
- dd_lang = gr.Dropdown(choices=["Automatic Detection"] + self.whisper_inf.available_langs,value=whisper_params["lang"], label="Language", info="If the language is known upfront, always set it manually", interactive=True)
104
- #dd_file_format = gr.Dropdown(choices=["SRT", "WebVTT", "txt"], value="SRT", label="File Format")
105
- dd_file_format = gr.Dropdown(choices=["TXT","SRT"], value="TXT", label="Output format", info="Output preview format", interactive=True, visible=False)
106
- with gr.Row():
107
- dd_translate_model = gr.Dropdown(choices=self.nllb_inf.available_models, value=nllb_params["model_size"],label="Model", info="Model used for translation", interactive=True)
108
- dd_target_lang = gr.Dropdown(choices=["English","Dutch","French","German"], value=nllb_params["target_lang"],label="Language", info="Language used for output translation", interactive=True)
109
- with gr.Column(scale=1):
110
- with gr.Row():
111
- cb_timestamp = gr.Checkbox(value=whisper_params["add_timestamp"], label="Add timestamp to output file",interactive=True)
112
- with gr.Row():
113
- cb_translate = gr.Checkbox(value=whisper_params["is_translate"], label="Translate transcription to English", info="Translate using OpenAI Whisper's built-in module",interactive=True)
114
- with gr.Row():
115
- cb_translate_output = gr.Checkbox(value=translation_params["translate_output"], label="Translate output to selected language", info="Translate using Facebook's NLLB",interactive=True)
116
-
117
- # with gr.Accordion("Speaker diarization", open=False, visible=True):
118
- # cb_diarize = gr.Checkbox(value=diarization_params["is_diarize"], label="Use diarization",interactive=True)
119
- # tb_hf_token = gr.Text(label="Token", value=diarization_params["hf_token"],info="Required to use diarization")
120
- # gr.Markdown("""
121
- # An access token can be created [here](https://hf.co/settings/tokens). If not done yet for your account, you need to accept the terms & conditions of [diarization](https://huggingface.co/pyannote/speaker-diarization-3.1) & [segmentation](https://huggingface.co/pyannote/segmentation-3.0).
122
- # """)
123
-
124
- with gr.Accordion("Speaker diarization", open=False, visible=True):
125
- cb_diarize = gr.Checkbox(value=diarization_params["is_diarize"],label="Use diarization",interactive=True)
126
- tb_hf_token = gr.Text(label="Token", value=diarization_params["hf_token"],info="An access token is required to use diarization & can be created [here](https://hf.co/settings/tokens). If not done yet for your account, you need to accept the terms & conditions of [diarization](https://huggingface.co/pyannote/speaker-diarization-3.1) & [segmentation](https://huggingface.co/pyannote/segmentation-3.0)")
127
-
128
- with gr.Accordion("Voice Detection Filter", open=False, visible=True):
129
- cb_vad_filter = gr.Checkbox(label="Enable Silero VAD Filter", value=vad_params["vad_filter"],
130
- interactive=True,
131
- info="Enable to transcribe only detected voice parts")
132
- sd_threshold = gr.Slider(minimum=0.0, maximum=1.0, step=0.01, label="Speech Threshold",
133
- value=vad_params["threshold"],
134
- info="Lower it to be more sensitive to small sounds")
135
- nb_min_speech_duration_ms = gr.Number(label="Minimum Speech Duration (ms)", precision=0,
136
- value=vad_params["min_speech_duration_ms"],
137
- info="Final speech chunks shorter than this time are thrown out")
138
- nb_max_speech_duration_s = gr.Number(label="Maximum Speech Duration (s)",
139
- value=vad_params["max_speech_duration_s"],
140
- info="Maximum duration of speech chunks in seconds")
141
- nb_min_silence_duration_ms = gr.Number(label="Minimum Silence Duration (ms)", precision=0,
142
- value=vad_params["min_silence_duration_ms"],
143
- info="In the end of each speech chunk wait for this time"
144
- " before separating it")
145
- nb_speech_pad_ms = gr.Number(label="Speech Padding (ms)", precision=0, value=vad_params["speech_pad_ms"],
146
- info="Final speech chunks are padded by this time each side")
147
-
148
- with gr.Accordion("Advanced options", open=False, visible=False):
149
- with gr.Accordion("Advanced diarization options", open=False, visible=True):
150
- dd_diarization_device = gr.Dropdown(label="Device",
151
- choices=self.whisper_inf.diarizer.get_available_device(),
152
- value=self.whisper_inf.diarizer.get_device())
153
-
154
- with gr.Accordion("Advanced processing options", open=False):
155
- nb_beam_size = gr.Number(label="Beam Size", value=whisper_params["beam_size"], precision=0, interactive=True,
156
- info="Beam size to use for decoding.")
157
- nb_log_prob_threshold = gr.Number(label="Log Probability Threshold", value=whisper_params["log_prob_threshold"], interactive=True,
158
- info="If the average log probability over sampled tokens is below this value, treat as failed.")
159
- nb_no_speech_threshold = gr.Number(label="No Speech Threshold", value=whisper_params["no_speech_threshold"], interactive=True,
160
- info="If the no speech probability is higher than this value AND the average log probability over sampled tokens is below 'Log Prob Threshold', consider the segment as silent.")
161
- dd_compute_type = gr.Dropdown(label="Compute Type", choices=self.whisper_inf.available_compute_types,
162
- value=self.whisper_inf.current_compute_type, interactive=True,
163
- allow_custom_value=True,
164
- info="Select the type of computation to perform.")
165
- nb_best_of = gr.Number(label="Best Of", value=whisper_params["best_of"], interactive=True,
166
- info="Number of candidates when sampling with non-zero temperature.")
167
- nb_patience = gr.Number(label="Patience", value=whisper_params["patience"], interactive=True,
168
- info="Beam search patience factor.")
169
- cb_condition_on_previous_text = gr.Checkbox(label="Condition On Previous Text", value=whisper_params["condition_on_previous_text"],
170
- interactive=True,
171
- info="Condition on previous text during decoding.")
172
- sld_prompt_reset_on_temperature = gr.Slider(label="Prompt Reset On Temperature", value=whisper_params["prompt_reset_on_temperature"],
173
- minimum=0, maximum=1, step=0.01, interactive=True,
174
- info="Resets prompt if temperature is above this value."
175
- " Arg has effect only if 'Condition On Previous Text' is True.")
176
- tb_initial_prompt = gr.Textbox(label="Initial Prompt", value=None, interactive=True,
177
- info="Initial prompt to use for decoding.")
178
- sd_temperature = gr.Slider(label="Temperature", value=whisper_params["temperature"], minimum=0.0,
179
- step=0.01, maximum=1.0, interactive=True,
180
- info="Temperature for sampling. It can be a tuple of temperatures, which will be successively used upon failures according to either `Compression Ratio Threshold` or `Log Prob Threshold`.")
181
- nb_compression_ratio_threshold = gr.Number(label="Compression Ratio Threshold", value=whisper_params["compression_ratio_threshold"],
182
- interactive=True,
183
- info="If the gzip compression ratio is above this value, treat as failed.")
184
- nb_chunk_length = gr.Number(label="Chunk Length (s)", value=lambda: whisper_params["chunk_length"],
185
- precision=0,
186
- info="The length of audio segments. If it is not None, it will overwrite the default chunk_length of the FeatureExtractor.")
187
- with gr.Group(visible=isinstance(self.whisper_inf, FasterWhisperInference)):
188
- nb_length_penalty = gr.Number(label="Length Penalty", value=whisper_params["length_penalty"],
189
- info="Exponential length penalty constant.")
190
- nb_repetition_penalty = gr.Number(label="Repetition Penalty", value=whisper_params["repetition_penalty"],
191
- info="Penalty applied to the score of previously generated tokens (set > 1 to penalize).")
192
- nb_no_repeat_ngram_size = gr.Number(label="No Repeat N-gram Size", value=whisper_params["no_repeat_ngram_size"],
193
- precision=0,
194
- info="Prevent repetitions of n-grams with this size (set 0 to disable).")
195
- tb_prefix = gr.Textbox(label="Prefix", value=lambda: whisper_params["prefix"],
196
- info="Optional text to provide as a prefix for the first window.")
197
- cb_suppress_blank = gr.Checkbox(label="Suppress Blank", value=whisper_params["suppress_blank"],
198
- info="Suppress blank outputs at the beginning of the sampling.")
199
- tb_suppress_tokens = gr.Textbox(label="Suppress Tokens", value=whisper_params["suppress_tokens"],
200
- info="List of token IDs to suppress. -1 will suppress a default set of symbols as defined in the model config.json file.")
201
- nb_max_initial_timestamp = gr.Number(label="Max Initial Timestamp", value=whisper_params["max_initial_timestamp"],
202
- info="The initial timestamp cannot be later than this.")
203
- cb_word_timestamps = gr.Checkbox(label="Word Timestamps", value=whisper_params["word_timestamps"],
204
- info="Extract word-level timestamps using the cross-attention pattern and dynamic time warping, and include the timestamps for each word in each segment.")
205
- tb_prepend_punctuations = gr.Textbox(label="Prepend Punctuations", value=whisper_params["prepend_punctuations"],
206
- info="If 'Word Timestamps' is True, merge these punctuation symbols with the next word.")
207
- tb_append_punctuations = gr.Textbox(label="Append Punctuations", value=whisper_params["append_punctuations"],
208
- info="If 'Word Timestamps' is True, merge these punctuation symbols with the previous word.")
209
- nb_max_new_tokens = gr.Number(label="Max New Tokens", value=lambda: whisper_params["max_new_tokens"],
210
- precision=0,
211
- info="Maximum number of new tokens to generate per-chunk. If not set, the maximum will be set by the default max_length.")
212
- nb_hallucination_silence_threshold = gr.Number(label="Hallucination Silence Threshold (sec)",
213
- value=lambda: whisper_params["hallucination_silence_threshold"],
214
- info="When 'Word Timestamps' is True, skip silent periods longer than this threshold (in seconds) when a possible hallucination is detected.")
215
- tb_hotwords = gr.Textbox(label="Hotwords", value=lambda: whisper_params["hotwords"],
216
- info="Hotwords/hint phrases to provide the model with. Has no effect if prefix is not None.")
217
- nb_language_detection_threshold = gr.Number(label="Language Detection Threshold", value=lambda: whisper_params["language_detection_threshold"],
218
- info="If the maximum probability of the language tokens is higher than this value, the language is detected.")
219
- nb_language_detection_segments = gr.Number(label="Language Detection Segments", value=lambda: whisper_params["language_detection_segments"],
220
- precision=0,
221
- info="Number of segments to consider for the language detection.")
222
- with gr.Group(visible=isinstance(self.whisper_inf, InsanelyFastWhisperInference)):
223
- nb_batch_size = gr.Number(label="Batch Size", value=whisper_params["batch_size"], precision=0)
224
-
225
- with gr.Accordion("Background Music Remover Filter", open=False):
226
- cb_bgm_separation = gr.Checkbox(label="Enable Background Music Remover Filter", value=uvr_params["is_separate_bgm"],
227
- interactive=True,
228
- info="Enabling this will remove background music by submodel before transcribing.")
229
- dd_uvr_device = gr.Dropdown(label="Device", value=self.whisper_inf.music_separator.device,
230
- choices=self.whisper_inf.music_separator.available_devices)
231
- dd_uvr_model_size = gr.Dropdown(label="Model", value=uvr_params["model_size"],
232
- choices=self.whisper_inf.music_separator.available_models)
233
- nb_uvr_segment_size = gr.Number(label="Segment Size", value=uvr_params["segment_size"], precision=0)
234
- cb_uvr_save_file = gr.Checkbox(label="Save separated files to output", value=uvr_params["save_file"])
235
- cb_uvr_enable_offload = gr.Checkbox(label="Offload sub model after removing background music",
236
- value=uvr_params["enable_offload"])
237
-
238
- # with gr.Accordion("Voice Detection Filter", open=False):
239
- # cb_vad_filter = gr.Checkbox(label="Enable Silero VAD Filter", value=vad_params["vad_filter"],
240
- # interactive=True,
241
- # info="Enable this to transcribe only detected voice parts by submodel.")
242
- # sd_threshold = gr.Slider(minimum=0.0, maximum=1.0, step=0.01, label="Speech Threshold",
243
- # value=vad_params["threshold"],
244
- # info="Lower it to be more sensitive to small sounds.")
245
- # nb_min_speech_duration_ms = gr.Number(label="Minimum Speech Duration (ms)", precision=0,
246
- # value=vad_params["min_speech_duration_ms"],
247
- # info="Final speech chunks shorter than this time are thrown out")
248
- # nb_max_speech_duration_s = gr.Number(label="Maximum Speech Duration (s)",
249
- # value=vad_params["max_speech_duration_s"],
250
- # info="Maximum duration of speech chunks in \"seconds\".")
251
- # nb_min_silence_duration_ms = gr.Number(label="Minimum Silence Duration (ms)", precision=0,
252
- # value=vad_params["min_silence_duration_ms"],
253
- # info="In the end of each speech chunk wait for this time"
254
- # " before separating it")
255
- # nb_speech_pad_ms = gr.Number(label="Speech Padding (ms)", precision=0, value=vad_params["speech_pad_ms"],
256
- # info="Final speech chunks are padded by this time each side")
257
-
258
- #dd_model.change(fn=self.on_change_models, inputs=[dd_model], outputs=[cb_translate])
259
-
260
- bool_whisper_enable_offload = whisper_params["enable_offload"]
261
- bool_diarization_enable_offload = diarization_params["enable_offload"]
262
-
263
- return (
264
- WhisperParameters(
265
- model_size=dd_model, lang=dd_lang, is_translate=cb_translate, beam_size=nb_beam_size,
266
- log_prob_threshold=nb_log_prob_threshold, no_speech_threshold=nb_no_speech_threshold,
267
- compute_type=dd_compute_type, best_of=nb_best_of, patience=nb_patience,
268
- condition_on_previous_text=cb_condition_on_previous_text, initial_prompt=tb_initial_prompt,
269
- temperature=sd_temperature, compression_ratio_threshold=nb_compression_ratio_threshold,
270
- vad_filter=cb_vad_filter, threshold=sd_threshold, min_speech_duration_ms=nb_min_speech_duration_ms,
271
- max_speech_duration_s=nb_max_speech_duration_s, min_silence_duration_ms=nb_min_silence_duration_ms,
272
- speech_pad_ms=nb_speech_pad_ms, chunk_length=nb_chunk_length, batch_size=nb_batch_size,
273
- is_diarize=cb_diarize, hf_token=tb_hf_token, diarization_device=dd_diarization_device,
274
- length_penalty=nb_length_penalty, repetition_penalty=nb_repetition_penalty,
275
- no_repeat_ngram_size=nb_no_repeat_ngram_size, prefix=tb_prefix, suppress_blank=cb_suppress_blank,
276
- suppress_tokens=tb_suppress_tokens, max_initial_timestamp=nb_max_initial_timestamp,
277
- word_timestamps=cb_word_timestamps, prepend_punctuations=tb_prepend_punctuations,
278
- append_punctuations=tb_append_punctuations, max_new_tokens=nb_max_new_tokens,
279
- hallucination_silence_threshold=nb_hallucination_silence_threshold, hotwords=tb_hotwords,
280
- language_detection_threshold=nb_language_detection_threshold,
281
- language_detection_segments=nb_language_detection_segments,
282
- prompt_reset_on_temperature=sld_prompt_reset_on_temperature, is_bgm_separate=cb_bgm_separation,
283
- uvr_device=dd_uvr_device, uvr_model_size=dd_uvr_model_size, uvr_segment_size=nb_uvr_segment_size,
284
- uvr_save_file=cb_uvr_save_file, uvr_enable_offload=cb_uvr_enable_offload,
285
- whisper_enable_offload=bool_whisper_enable_offload, diarization_enable_offload=bool_diarization_enable_offload
286
- ),
287
- dd_file_format,
288
- cb_timestamp,
289
- cb_translate_output,
290
- dd_translate_model,
291
- dd_target_lang
292
- )
293
-
294
- def launch(self):
295
- translation_params = self.default_params["translation"]
296
- deepl_params = translation_params["deepl"]
297
- nllb_params = translation_params["nllb"]
298
- uvr_params = self.default_params["bgm_separation"]
299
-
300
- with self.app:
301
- with gr.Row():
302
- with gr.Column():
303
- gr.Markdown(MARKDOWN, elem_id="md_project")
304
- with gr.Tabs():
305
- with gr.TabItem("Audio upload/record"): # tab1
306
- with gr.Column():
307
- #input_file = gr.Files(type="filepath", label="Upload File here")
308
- #input_file = gr.File(type="filepath", label="Upload audio/video file here")
309
- input_file = gr.Audio(type='filepath', elem_id="audio_input", show_download_button=True)
310
- tb_input_folder = gr.Textbox(label="Input Folder Path (Optional)",
311
- info="Optional: Specify the folder path where the input files are located, if you prefer to use local files instead of uploading them."
312
- " Leave this field empty if you do not wish to use a local path.",
313
- visible=self.args.colab,
314
- value="")
315
-
316
- whisper_params, dd_file_format, cb_timestamp, cb_translate_output, dd_translate_model, dd_target_lang = self.create_whisper_parameters()
317
-
318
- with gr.Row():
319
- btn_run = gr.Button("Transcribe", variant="primary")
320
- btn_reset = gr.Button(value="Reset")
321
- btn_reset.click(None,js="window.location.reload()")
322
- with gr.Row():
323
- with gr.Column(scale=4):
324
- tb_indicator = gr.Textbox(label="Output preview (Always review & verify the output generated by AI models)", show_copy_button=True, show_label=True)
325
- with gr.Column(scale=1):
326
- tb_info = gr.Textbox(label="Output info", interactive=False, show_copy_button=True)
327
- files_subtitles = gr.Files(label="Output data", interactive=False, file_count="multiple")
328
- # btn_openfolder = gr.Button('📂', scale=1)
329
-
330
- params = [input_file, tb_input_folder, dd_file_format, cb_timestamp, cb_translate_output, dd_translate_model, dd_target_lang]
331
- btn_run.click(fn=self.whisper_inf.transcribe_file,
332
- inputs=params + whisper_params.as_list(),
333
- outputs=[tb_indicator, files_subtitles, tb_info])
334
- # btn_openfolder.click(fn=lambda: self.open_folder("outputs"), inputs=None, outputs=None)
335
-
336
- with gr.TabItem("Device info"): # tab2
337
- with gr.Column():
338
- gr.Markdown(device_info, label="Hardware info & installed packages")
339
-
340
- # Launch the app with optional gradio settings
341
- args = self.args
342
-
343
- self.app.queue(
344
- api_open=args.api_open
345
- ).launch(
346
- share=args.share,
347
- server_name=args.server_name,
348
- server_port=args.server_port,
349
- auth=(args.username, args.password) if args.username and args.password else None,
350
- root_path=args.root_path,
351
- inbrowser=args.inbrowser
352
- )
353
-
354
- @staticmethod
355
- def open_folder(folder_path: str):
356
- if os.path.exists(folder_path):
357
- os.system(f"start {folder_path}")
358
- else:
359
- os.makedirs(folder_path, exist_ok=True)
360
- print(f"The directory path {folder_path} has newly created.")
361
-
362
- @staticmethod
363
- def on_change_models(model_size: str):
364
- translatable_model = ["large", "large-v1", "large-v2", "large-v3"]
365
- if model_size not in translatable_model:
366
- return gr.Checkbox(visible=False, value=False, interactive=False)
367
- #return gr.Checkbox(visible=True, value=False, label="Translate to English (large models only)", interactive=False)
368
- else:
369
- return gr.Checkbox(visible=True, value=False, label="Translate to English", interactive=True)
370
-
371
- # Create the parser for command-line arguments
372
- parser = argparse.ArgumentParser()
373
- parser.add_argument('--whisper_type', type=str, default="faster-whisper",
374
- help='A type of the whisper implementation between: ["whisper", "faster-whisper", "insanely-fast-whisper"]')
375
- parser.add_argument('--share', type=str2bool, default=False, nargs='?', const=True, help='Gradio share value')
376
- parser.add_argument('--server_name', type=str, default=None, help='Gradio server host')
377
- parser.add_argument('--server_port', type=int, default=None, help='Gradio server port')
378
- parser.add_argument('--root_path', type=str, default=None, help='Gradio root path')
379
- parser.add_argument('--username', type=str, default=None, help='Gradio authentication username')
380
- parser.add_argument('--password', type=str, default=None, help='Gradio authentication password')
381
- parser.add_argument('--theme', type=str, default=None, help='Gradio Blocks theme')
382
- parser.add_argument('--colab', type=str2bool, default=False, nargs='?', const=True, help='Is colab user or not')
383
- parser.add_argument('--api_open', type=str2bool, default=False, nargs='?', const=True, help='Enable api or not in Gradio')
384
- parser.add_argument('--inbrowser', type=str2bool, default=True, nargs='?', const=True, help='Whether to automatically start Gradio app or not')
385
- parser.add_argument('--whisper_model_dir', type=str, default=WHISPER_MODELS_DIR,
386
- help='Directory path of the whisper model')
387
- parser.add_argument('--faster_whisper_model_dir', type=str, default=FASTER_WHISPER_MODELS_DIR,
388
- help='Directory path of the faster-whisper model')
389
- parser.add_argument('--insanely_fast_whisper_model_dir', type=str,
390
- default=INSANELY_FAST_WHISPER_MODELS_DIR,
391
- help='Directory path of the insanely-fast-whisper model')
392
- parser.add_argument('--diarization_model_dir', type=str, default=DIARIZATION_MODELS_DIR,
393
- help='Directory path of the diarization model')
394
- parser.add_argument('--nllb_model_dir', type=str, default=NLLB_MODELS_DIR,
395
- help='Directory path of the Facebook NLLB model')
396
- parser.add_argument('--uvr_model_dir', type=str, default=UVR_MODELS_DIR,
397
- help='Directory path of the UVR model')
398
- parser.add_argument('--output_dir', type=str, default=OUTPUT_DIR, help='Directory path of the outputs')
399
- _args = parser.parse_args()
400
-
401
- if __name__ == "__main__":
402
- app = App(args=_args)
403
- app.launch()