From 35f130ee85ff7b86283f5ba1e7d80fef6722c598 Mon Sep 17 00:00:00 2001 From: SWivid Date: Wed, 4 Jun 2025 06:11:49 +0800 Subject: [PATCH] minor update for infer-gradio --- src/f5_tts/infer/infer_gradio.py | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/src/f5_tts/infer/infer_gradio.py b/src/f5_tts/infer/infer_gradio.py index c6d1d9b..f4c3aef 100644 --- a/src/f5_tts/infer/infer_gradio.py +++ b/src/f5_tts/infer/infer_gradio.py @@ -128,7 +128,7 @@ def load_text_from_file(file): return gr.update(value=text) -@lru_cache(maxsize=100) # NOTE. need to ensure params of infer() hashable +@lru_cache(maxsize=1000) # NOTE. need to ensure params of infer() hashable @gpu_decorator def infer( ref_audio_orig, @@ -209,14 +209,6 @@ def infer( return (final_sample_rate, final_wave), spectrogram_path, ref_text, used_seed -with gr.Blocks() as app_credits: - gr.Markdown(""" -# Credits - -* [mrfakename](https://github.com/fakerybakery) for the original [online demo](https://huggingface.co/spaces/mrfakename/E2-F5-TTS) -* [RootingInLoad](https://github.com/RootingInLoad) for initial chunk generation and podcast app exploration -* [jpgallegoar](https://github.com/jpgallegoar) for multiple speech-type generation & voice chat -""") with gr.Blocks() as app_tts: gr.Markdown("# Batched TTS") ref_audio_input = gr.Audio(label="Reference Audio", type="filepath") @@ -320,6 +312,12 @@ with gr.Blocks() as app_tts: outputs=[ref_text_input], ) + ref_audio_input.clear( + lambda: [None, None], + None, + [ref_text_input, ref_text_file], + ) + generate_btn.click( basic_tts, inputs=[ @@ -932,6 +930,16 @@ Have a conversation with an AI using your reference voice! ) +with gr.Blocks() as app_credits: + gr.Markdown(""" +# Credits + +* [mrfakename](https://github.com/fakerybakery) for the original [online demo](https://huggingface.co/spaces/mrfakename/E2-F5-TTS) +* [RootingInLoad](https://github.com/RootingInLoad) for initial chunk generation and podcast app exploration +* [jpgallegoar](https://github.com/jpgallegoar) for multiple speech-type generation & voice chat +""") + + with gr.Blocks() as app: gr.Markdown( f"""