Diotoara commited on
Commit
9ab8a35
·
verified ·
1 Parent(s): e114f9c

Update f5_tts_app.py

Browse files
Files changed (1) hide show
  1. f5_tts_app.py +32 -33
f5_tts_app.py CHANGED
@@ -1,44 +1,43 @@
1
- # import os
2
- # import subprocess
3
 
4
- # # The official command-line script registered by the F5-TTS package.
5
- # # This is the most reliable way to start the app.
6
- # command = "f5-tts_infer-gradio"
7
 
8
- # # Use subprocess to execute the command.
9
- # # check=True will ensure the script fails if the command can't be run.
10
- # print(f"Starting F5-TTS Gradio interface with: {command}")
11
- # subprocess.run(command, shell=True, check=True)
12
 
13
  # f5_tts_app.py
14
 
15
- # Install necessary packages (if not already installed)
16
- import os
17
- import subprocess
18
- import sys
19
 
20
 
21
- import gradio as gr
22
- # from f5_tts import f5_tts_infer # Replace with actual import from repo
23
- from f5_tts.infer import infer_gradio as app_module
24
- if __name__ == '__main__':
25
- app_module.app.render() # Assuming the Gradio object is named 'app' inside the module
26
- app_module.app.launch()
27
 
28
 
29
- def tts_function(text):
30
- # This depends on F5-TTS repo structure
31
- # Example: returns a path to generated audio
32
- audio_path = f5_tts_infer(text)
33
- return audio_path
34
 
35
- # Gradio Interface
36
- iface = gr.Interface(
37
- fn=tts_function,
38
- inputs=gr.Textbox(label="Enter Text"),
39
- outputs=gr.Audio(label="Generated Speech"),
40
- title="F5-TTS Speech Generator",
41
- description="Enter text and generate speech using F5-TTS"
42
- )
43
 
44
- iface.launch(share=True)
 
1
+ import os
2
+ import subprocess
3
 
4
+ # The official command-line script registered by the F5-TTS package.
5
+ # This is the most reliable way to start the app.
6
+ command = "f5-tts_infer-gradio"
7
 
8
+ # Use subprocess to execute the command.
9
+ # check=True will ensure the script fails if the command can't be run.
10
+ print(f"Starting F5-TTS Gradio interface with: {command}")
11
+ subprocess.run(command, shell=True, check=True)
12
 
13
  # f5_tts_app.py
14
 
15
+ # import os
16
+ # import subprocess
17
+ # import sys
 
18
 
19
 
20
+ # import gradio as gr
21
+ # # from f5_tts import f5_tts_infer # Replace with actual import from repo
22
+ # from f5_tts.infer import infer_gradio as app_module
23
+ # if __name__ == '__main__':
24
+ # app_module.app.render() # Assuming the Gradio object is named 'app' inside the module
25
+ # app_module.app.launch()
26
 
27
 
28
+ # def tts_function(text):
29
+ # # This depends on F5-TTS repo structure
30
+ # # Example: returns a path to generated audio
31
+ # audio_path = f5_tts_infer(text)
32
+ # return audio_path
33
 
34
+ # # Gradio Interface
35
+ # iface = gr.Interface(
36
+ # fn=tts_function,
37
+ # inputs=gr.Textbox(label="Enter Text"),
38
+ # outputs=gr.Audio(label="Generated Speech"),
39
+ # title="F5-TTS Speech Generator",
40
+ # description="Enter text and generate speech using F5-TTS"
41
+ # )
42
 
43
+ # iface.launch(share=True)