|
import gradio as gr |
|
|
|
from config import Config |
|
from .events import * |
|
|
|
|
|
def audio_tab(): |
|
with gr.Row(): |
|
with gr.Column(): |
|
with gr.Group(): |
|
with gr.Group(): |
|
text = gr.Textbox(lines=5, label="Enter text") |
|
mode = gr.Radio(["SFT", "VC", "VC-CrossLingual", "Instruct"], label="Mode", value="SFT",) |
|
sft_speaker = gr.Radio(sft_speakers, label="Select speaker") |
|
with gr.Accordion('Voice Clone', open=False): |
|
speaker_audio = gr.Audio(label="Upload Audio", type='numpy', visible=False) |
|
clear_speaker_audio = gr.Button(value="Clear Audio") |
|
|
|
with gr.Accordion('Instruct', open=False): |
|
voice_instructions = gr.Textbox(lines=5, label="Enter voice instructions", visible=False) |
|
|
|
with gr.Column(): |
|
output_audio = gr.Audio(label="Output Audio", interactive=False, show_download_button=True) |
|
clear_output_audio = gr.Button(value="Clear Audio") |
|
generate_audio = gr.Button(value="Generate Audio") |
|
|
|
|
|
|
|
|
|
clear_speaker_audio.click(clear_audio, speaker_audio, speaker_audio) |
|
clear_output_audio.click(clear_audio, output_audio, output_audio) |
|
|
|
|
|
mode.change( |
|
update_mode, |
|
[mode, sft_speaker, speaker_audio, voice_instructions], |
|
[sft_speaker, speaker_audio, voice_instructions] |
|
) |
|
|
|
|
|
generate_audio.click( |
|
gen_audio, |
|
[text, mode, sft_speaker, speaker_audio, voice_instructions], |
|
[output_audio] |
|
) |
|
|