(
mode_with_reference: str,
duration_control_enabled: bool,
duration_tokens: int,
evt: gr.SelectData,
)
| 303 | |
| 304 | |
| 305 | def 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 | |
| 339 | def run_inference( |
nothing calls this directly
no test coverage detected