MCPcopy Create free account
hub / github.com/OpenMOSS/MOSS-TTS / apply_example_selection

Function apply_example_selection

clis/moss_tts_app.py:305–336  ·  view source on GitHub ↗
(
    mode_with_reference: str,
    duration_control_enabled: bool,
    duration_tokens: int,
    evt: gr.SelectData,
)

Source from the content-addressed store, hash-verified

303
304
305def apply_example_selection(
306 mode_with_reference: str,
307 duration_control_enabled: bool,
308 duration_tokens: int,
309 evt: gr.SelectData,
310):
311 if evt is None or evt.index is None:
312 return gr.update(), gr.update(), gr.update(), gr.update(), gr.update(), gr.update()
313
314 if isinstance(evt.index, (tuple, list)):
315 row_idx = int(evt.index[0])
316 else:
317 row_idx = int(evt.index)
318
319 if row_idx < 0 or row_idx >= len(EXAMPLE_ROWS):
320 return gr.update(), gr.update(), gr.update(), gr.update(), gr.update(), gr.update()
321
322 _, audio_path, example_text = EXAMPLE_ROWS[row_idx]
323 duration_slider_update, duration_hint, duration_checkbox_update = update_duration_controls(
324 duration_control_enabled,
325 example_text,
326 duration_tokens,
327 mode_with_reference,
328 )
329 return (
330 audio_path,
331 example_text,
332 render_mode_hint(audio_path, mode_with_reference),
333 duration_slider_update,
334 duration_hint,
335 duration_checkbox_update,
336 )
337
338
339def run_inference(

Callers

nothing calls this directly

Calls 3

update_duration_controlsFunction · 0.85
render_mode_hintFunction · 0.85
updateMethod · 0.45

Tested by

no test coverage detected