Update app.py
Browse files
app.py
CHANGED
@@ -141,96 +141,91 @@ class App:
|
|
141 |
" before separating it")
|
142 |
nb_speech_pad_ms = gr.Number(label="Speech Padding (ms)", precision=0, value=vad_params["speech_pad_ms"],
|
143 |
info="Final speech chunks are padded by this time each side")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
144 |
|
145 |
-
with gr.Accordion("Advanced options", open=False, visible=
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
info="If the maximum probability of the language tokens is higher than this value, the language is detected.")
|
216 |
-
nb_language_detection_segments = gr.Number(label="Language Detection Segments", value=lambda: whisper_params["language_detection_segments"],
|
217 |
-
precision=0,
|
218 |
-
info="Number of segments to consider for the language detection.")
|
219 |
-
with gr.Group(visible=isinstance(self.whisper_inf, InsanelyFastWhisperInference)):
|
220 |
-
nb_batch_size = gr.Number(label="Batch Size", value=whisper_params["batch_size"], precision=0)
|
221 |
-
|
222 |
-
with gr.Accordion("Background Music Remover Filter", open=False):
|
223 |
-
cb_bgm_separation = gr.Checkbox(label="Enable Background Music Remover Filter", value=uvr_params["is_separate_bgm"],
|
224 |
-
interactive=True,
|
225 |
-
info="Enabling this will remove background music by submodel before transcribing.")
|
226 |
-
dd_uvr_device = gr.Dropdown(label="Device", value=self.whisper_inf.music_separator.device,
|
227 |
-
choices=self.whisper_inf.music_separator.available_devices)
|
228 |
-
dd_uvr_model_size = gr.Dropdown(label="Model", value=uvr_params["model_size"],
|
229 |
-
choices=self.whisper_inf.music_separator.available_models)
|
230 |
-
nb_uvr_segment_size = gr.Number(label="Segment Size", value=uvr_params["segment_size"], precision=0)
|
231 |
-
cb_uvr_save_file = gr.Checkbox(label="Save separated files to output", value=uvr_params["save_file"])
|
232 |
-
cb_uvr_enable_offload = gr.Checkbox(label="Offload sub model after removing background music",
|
233 |
-
value=uvr_params["enable_offload"])
|
234 |
|
235 |
|
236 |
#dd_model.change(fn=self.on_change_models, inputs=[dd_model], outputs=[cb_translate])
|
|
|
141 |
" before separating it")
|
142 |
nb_speech_pad_ms = gr.Number(label="Speech Padding (ms)", precision=0, value=vad_params["speech_pad_ms"],
|
143 |
info="Final speech chunks are padded by this time each side")
|
144 |
+
|
145 |
+
|
146 |
+
with gr.Accordion("Background Music Remover Filter", open=False):
|
147 |
+
cb_bgm_separation = gr.Checkbox(label="Enable Background Music Remover Filter", value=uvr_params["is_separate_bgm"],
|
148 |
+
interactive=True,
|
149 |
+
info="Enabling this will remove background music by submodel before transcribing")
|
150 |
+
dd_uvr_device = gr.Dropdown(label="Device", value=self.whisper_inf.music_separator.device,
|
151 |
+
choices=self.whisper_inf.music_separator.available_devices)
|
152 |
+
dd_uvr_model_size = gr.Dropdown(label="Model", value=uvr_params["model_size"],
|
153 |
+
choices=self.whisper_inf.music_separator.available_models)
|
154 |
+
nb_uvr_segment_size = gr.Number(label="Segment Size", value=uvr_params["segment_size"], precision=0)
|
155 |
+
cb_uvr_save_file = gr.Checkbox(label="Save separated files to output", value=uvr_params["save_file"])
|
156 |
+
cb_uvr_enable_offload = gr.Checkbox(label="Offload sub model after removing background music",
|
157 |
+
value=uvr_params["enable_offload"])
|
158 |
|
159 |
+
with gr.Accordion("Advanced processing options", open=False, visible=False):
|
160 |
+
nb_beam_size = gr.Number(label="Beam Size", value=whisper_params["beam_size"], precision=0, interactive=True,
|
161 |
+
info="Beam size to use for decoding.")
|
162 |
+
nb_log_prob_threshold = gr.Number(label="Log Probability Threshold", value=whisper_params["log_prob_threshold"], interactive=True,
|
163 |
+
info="If the average log probability over sampled tokens is below this value, treat as failed.")
|
164 |
+
nb_no_speech_threshold = gr.Number(label="No Speech Threshold", value=whisper_params["no_speech_threshold"], interactive=True,
|
165 |
+
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.")
|
166 |
+
dd_compute_type = gr.Dropdown(label="Compute Type", choices=self.whisper_inf.available_compute_types,
|
167 |
+
value=self.whisper_inf.current_compute_type, interactive=True,
|
168 |
+
allow_custom_value=True,
|
169 |
+
info="Select the type of computation to perform.")
|
170 |
+
nb_best_of = gr.Number(label="Best Of", value=whisper_params["best_of"], interactive=True,
|
171 |
+
info="Number of candidates when sampling with non-zero temperature.")
|
172 |
+
nb_patience = gr.Number(label="Patience", value=whisper_params["patience"], interactive=True,
|
173 |
+
info="Beam search patience factor.")
|
174 |
+
cb_condition_on_previous_text = gr.Checkbox(label="Condition On Previous Text", value=whisper_params["condition_on_previous_text"],
|
175 |
+
interactive=True,
|
176 |
+
info="Condition on previous text during decoding.")
|
177 |
+
sld_prompt_reset_on_temperature = gr.Slider(label="Prompt Reset On Temperature", value=whisper_params["prompt_reset_on_temperature"],
|
178 |
+
minimum=0, maximum=1, step=0.01, interactive=True,
|
179 |
+
info="Resets prompt if temperature is above this value."
|
180 |
+
" Arg has effect only if 'Condition On Previous Text' is True.")
|
181 |
+
tb_initial_prompt = gr.Textbox(label="Initial Prompt", value=None, interactive=True,
|
182 |
+
info="Initial prompt to use for decoding.")
|
183 |
+
sd_temperature = gr.Slider(label="Temperature", value=whisper_params["temperature"], minimum=0.0,
|
184 |
+
step=0.01, maximum=1.0, interactive=True,
|
185 |
+
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`.")
|
186 |
+
nb_compression_ratio_threshold = gr.Number(label="Compression Ratio Threshold", value=whisper_params["compression_ratio_threshold"],
|
187 |
+
interactive=True,
|
188 |
+
info="If the gzip compression ratio is above this value, treat as failed.")
|
189 |
+
nb_chunk_length = gr.Number(label="Chunk Length (s)", value=lambda: whisper_params["chunk_length"],
|
190 |
+
precision=0,
|
191 |
+
info="The length of audio segments. If it is not None, it will overwrite the default chunk_length of the FeatureExtractor.")
|
192 |
+
with gr.Group(visible=isinstance(self.whisper_inf, FasterWhisperInference)):
|
193 |
+
nb_length_penalty = gr.Number(label="Length Penalty", value=whisper_params["length_penalty"],
|
194 |
+
info="Exponential length penalty constant.")
|
195 |
+
nb_repetition_penalty = gr.Number(label="Repetition Penalty", value=whisper_params["repetition_penalty"],
|
196 |
+
info="Penalty applied to the score of previously generated tokens (set > 1 to penalize).")
|
197 |
+
nb_no_repeat_ngram_size = gr.Number(label="No Repeat N-gram Size", value=whisper_params["no_repeat_ngram_size"],
|
198 |
+
precision=0,
|
199 |
+
info="Prevent repetitions of n-grams with this size (set 0 to disable).")
|
200 |
+
tb_prefix = gr.Textbox(label="Prefix", value=lambda: whisper_params["prefix"],
|
201 |
+
info="Optional text to provide as a prefix for the first window.")
|
202 |
+
cb_suppress_blank = gr.Checkbox(label="Suppress Blank", value=whisper_params["suppress_blank"],
|
203 |
+
info="Suppress blank outputs at the beginning of the sampling.")
|
204 |
+
tb_suppress_tokens = gr.Textbox(label="Suppress Tokens", value=whisper_params["suppress_tokens"],
|
205 |
+
info="List of token IDs to suppress. -1 will suppress a default set of symbols as defined in the model config.json file.")
|
206 |
+
nb_max_initial_timestamp = gr.Number(label="Max Initial Timestamp", value=whisper_params["max_initial_timestamp"],
|
207 |
+
info="The initial timestamp cannot be later than this.")
|
208 |
+
cb_word_timestamps = gr.Checkbox(label="Word Timestamps", value=whisper_params["word_timestamps"],
|
209 |
+
info="Extract word-level timestamps using the cross-attention pattern and dynamic time warping, and include the timestamps for each word in each segment.")
|
210 |
+
tb_prepend_punctuations = gr.Textbox(label="Prepend Punctuations", value=whisper_params["prepend_punctuations"],
|
211 |
+
info="If 'Word Timestamps' is True, merge these punctuation symbols with the next word.")
|
212 |
+
tb_append_punctuations = gr.Textbox(label="Append Punctuations", value=whisper_params["append_punctuations"],
|
213 |
+
info="If 'Word Timestamps' is True, merge these punctuation symbols with the previous word.")
|
214 |
+
nb_max_new_tokens = gr.Number(label="Max New Tokens", value=lambda: whisper_params["max_new_tokens"],
|
215 |
+
precision=0,
|
216 |
+
info="Maximum number of new tokens to generate per-chunk. If not set, the maximum will be set by the default max_length.")
|
217 |
+
nb_hallucination_silence_threshold = gr.Number(label="Hallucination Silence Threshold (sec)",
|
218 |
+
value=lambda: whisper_params["hallucination_silence_threshold"],
|
219 |
+
info="When 'Word Timestamps' is True, skip silent periods longer than this threshold (in seconds) when a possible hallucination is detected.")
|
220 |
+
tb_hotwords = gr.Textbox(label="Hotwords", value=lambda: whisper_params["hotwords"],
|
221 |
+
info="Hotwords/hint phrases to provide the model with. Has no effect if prefix is not None.")
|
222 |
+
nb_language_detection_threshold = gr.Number(label="Language Detection Threshold", value=lambda: whisper_params["language_detection_threshold"],
|
223 |
+
info="If the maximum probability of the language tokens is higher than this value, the language is detected.")
|
224 |
+
nb_language_detection_segments = gr.Number(label="Language Detection Segments", value=lambda: whisper_params["language_detection_segments"],
|
225 |
+
precision=0,
|
226 |
+
info="Number of segments to consider for the language detection.")
|
227 |
+
with gr.Group(visible=isinstance(self.whisper_inf, InsanelyFastWhisperInference)):
|
228 |
+
nb_batch_size = gr.Number(label="Batch Size", value=whisper_params["batch_size"], precision=0)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
229 |
|
230 |
|
231 |
#dd_model.change(fn=self.on_change_models, inputs=[dd_model], outputs=[cb_translate])
|