text_to_audio / app.py
GopalGoyal's picture
Add application file
d2259bf
raw
history blame contribute delete
659 Bytes
import os
from TTS.api import TTS
tts = TTS("tts_models/en/multi-dataset/tortoise-v2")
import gradio as gr
try:
tts.to("cuda")
except:
print("Cuda not available")
def text_to_speech(text):
tts.tts_to_file(text=text,
file_path="output.wav",
voice_dir="./tortoise-tts/tortoise/voices",
speaker="lj",
num_autoregressive_samples=1,
diffusion_iterations=10)
return "output.wav"
def greet(text):
return text_to_speech(text)
demo = gr.Interface(fn=greet, inputs="textbox", outputs="textbox")
if __name__ == "__main__":
demo.launch()