Spaces:
Running
on
Zero
Running
on
Zero
File size: 1,168 Bytes
f6a37be dd217c7 ca0d05f 63745ec ca0d05f cb99a43 ca5ec77 ca0d05f 02e6d18 ca0d05f 02e6d18 ca0d05f |
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 |
import spaces
import gradio as gr
from f5_tts.infer.utils_infer import remove_silence_for_generated_wav
from f5_tts.api import F5TTS
import tempfile
import os
f5tts = F5TTS()
@spaces.GPU
def run_tts(ref_audio, ref_text, gen_text, remove_silence=False):
output_wav_path = tempfile.mktemp(suffix=".wav")
wav, sr, _ = f5tts.infer(
ref_file=ref_audio,
ref_text=ref_text,
gen_text=gen_text,
file_wave=output_wav_path,
remove_silence=remove_silence,
)
return output_wav_path
demo = gr.Interface(
fn=run_tts,
inputs=[
gr.Audio(label="Reference Audio", type="filepath"),
gr.Textbox(label="Reference Text", placeholder="some call me nature, others call me mother nature."),
gr.Textbox(label="Generation Text", placeholder="I don't really care what you call me..."),
gr.Checkbox(label="Remove Silence from Output?", value=False)
],
outputs=gr.Audio(label="Generated Speech"),
title="🗣️ F5-TTS Demo",
description="Upload a reference voice, give reference and generation text, and hear it in the same voice!",
)
if __name__ == "__main__":
demo.launch()
|