Spaces:
Runtime error
Runtime error
Commit
·
d2259bf
1
Parent(s):
1201af4
Add application file
Browse files- app.py +27 -0
- requirements.txt +3 -0
app.py
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
from TTS.api import TTS
|
3 |
+
tts = TTS("tts_models/en/multi-dataset/tortoise-v2")
|
4 |
+
import gradio as gr
|
5 |
+
try:
|
6 |
+
tts.to("cuda")
|
7 |
+
except:
|
8 |
+
print("Cuda not available")
|
9 |
+
def text_to_speech(text):
|
10 |
+
tts.tts_to_file(text=text,
|
11 |
+
file_path="output.wav",
|
12 |
+
voice_dir="./tortoise-tts/tortoise/voices",
|
13 |
+
speaker="lj",
|
14 |
+
num_autoregressive_samples=1,
|
15 |
+
diffusion_iterations=10)
|
16 |
+
|
17 |
+
return "output.wav"
|
18 |
+
|
19 |
+
|
20 |
+
|
21 |
+
def greet(text):
|
22 |
+
return text_to_speech(text)
|
23 |
+
|
24 |
+
demo = gr.Interface(fn=greet, inputs="textbox", outputs="textbox")
|
25 |
+
|
26 |
+
if __name__ == "__main__":
|
27 |
+
demo.launch()
|
requirements.txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
TTS
|
2 |
+
-e git+https://github.com/neonbjb/tortoise-tts.git
|
3 |
+
gradio
|