| import os | |
| import subprocess | |
| # The official command-line script registered by the F5-TTS package. | |
| # This is the most reliable way to start the app. | |
| command = "f5-tts_infer-gradio" | |
| # Use subprocess to execute the command. | |
| # check=True will ensure the script fails if the command can't be run. | |
| print(f"Starting F5-TTS Gradio interface with: {command}") | |
| subprocess.run(command, shell=True, check=True) | |
| # f5_tts_app.py | |
| # import os | |
| # import subprocess | |
| # import sys | |
| # import gradio as gr | |
| # # from f5_tts import f5_tts_infer # Replace with actual import from repo | |
| # from f5_tts.infer import infer_gradio as app_module | |
| # if __name__ == '__main__': | |
| # app_module.app.render() # Assuming the Gradio object is named 'app' inside the module | |
| # app_module.app.launch() | |
| # def tts_function(text): | |
| # # This depends on F5-TTS repo structure | |
| # # Example: returns a path to generated audio | |
| # audio_path = f5_tts_infer(text) | |
| # return audio_path | |
| # # Gradio Interface | |
| # iface = gr.Interface( | |
| # fn=tts_function, | |
| # inputs=gr.Textbox(label="Enter Text"), | |
| # outputs=gr.Audio(label="Generated Speech"), | |
| # title="F5-TTS Speech Generator", | |
| # description="Enter text and generate speech using F5-TTS" | |
| # ) | |
| # iface.launch(share=True) | |