mirror of
https://github.com/remsky/Kokoro-FastAPI.git
synced 2025-04-13 09:39:17 +00:00
42 lines
1.1 KiB
Python
42 lines
1.1 KiB
Python
from typing import Tuple, Optional
|
|
|
|
import gradio as gr
|
|
|
|
from .. import api, config
|
|
|
|
|
|
def create_model_column(voice_ids: Optional[list] = None) -> Tuple[gr.Column, dict]:
|
|
"""Create the model settings column."""
|
|
if voice_ids is None:
|
|
voice_ids = []
|
|
|
|
with gr.Column(scale=1) as col:
|
|
gr.Markdown("### Model Settings")
|
|
|
|
# Status button starts in waiting state
|
|
status_btn = gr.Button(
|
|
"⌛ TTS Service: Waiting for Service...", variant="secondary"
|
|
)
|
|
|
|
voice_input = gr.Dropdown(
|
|
choices=voice_ids,
|
|
label="Voice(s)",
|
|
value=voice_ids[0] if voice_ids else None,
|
|
interactive=True,
|
|
multiselect=True,
|
|
)
|
|
format_input = gr.Dropdown(
|
|
choices=config.AUDIO_FORMATS, label="Audio Format", value="mp3"
|
|
)
|
|
speed_input = gr.Slider(
|
|
minimum=0.5, maximum=2.0, value=1.0, step=0.1, label="Speed"
|
|
)
|
|
|
|
components = {
|
|
"status_btn": status_btn,
|
|
"voice": voice_input,
|
|
"format": format_input,
|
|
"speed": speed_input,
|
|
}
|
|
|
|
return col, components
|