minor update for infer-gradio

This commit is contained in:
SWivid
2025-06-04 06:11:49 +08:00
parent e6469f705f
commit 35f130ee85

View File

@@ -128,7 +128,7 @@ def load_text_from_file(file):
return gr.update(value=text) 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 @gpu_decorator
def infer( def infer(
ref_audio_orig, ref_audio_orig,
@@ -209,14 +209,6 @@ def infer(
return (final_sample_rate, final_wave), spectrogram_path, ref_text, used_seed 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: with gr.Blocks() as app_tts:
gr.Markdown("# Batched TTS") gr.Markdown("# Batched TTS")
ref_audio_input = gr.Audio(label="Reference Audio", type="filepath") ref_audio_input = gr.Audio(label="Reference Audio", type="filepath")
@@ -320,6 +312,12 @@ with gr.Blocks() as app_tts:
outputs=[ref_text_input], outputs=[ref_text_input],
) )
ref_audio_input.clear(
lambda: [None, None],
None,
[ref_text_input, ref_text_file],
)
generate_btn.click( generate_btn.click(
basic_tts, basic_tts,
inputs=[ 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: with gr.Blocks() as app:
gr.Markdown( gr.Markdown(
f""" f"""