File size: 1,715 Bytes
acde4c3 7f167fb 71c84e0 7f167fb acde4c3 71c84e0 acde4c3 7f167fb acde4c3 7f167fb acde4c3 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
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",) # automate with speech recognition pipeline
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")
# Events
# Clear Audio
clear_speaker_audio.click(clear_audio, speaker_audio, speaker_audio)
clear_output_audio.click(clear_audio, output_audio, output_audio)
# Mode
mode.change(
update_mode,
[mode, sft_speaker, speaker_audio, voice_instructions],
[sft_speaker, speaker_audio, voice_instructions]
)
# Generate Audio
generate_audio.click(
gen_audio,
[text, mode, sft_speaker, speaker_audio, voice_instructions],
[output_audio]
)
|