amirgame197's picture
Update app.py
40b6778 verified
raw
history blame contribute delete
727 Bytes
import tempfile ,os
import gradio as gr
MAX_TXT_LEN = 5000
def tts(text: str):
if len(text) > MAX_TXT_LEN:
text = text[:MAX_TXT_LEN]
print(f"Input text was cutoff since it went over the {MAX_TXT_LEN} character limit.")
print(text)
import subprocess
with tempfile.NamedTemporaryFile(suffix=".wav", delete=False) as fp:
#print(fp)
output = subprocess.check_output(f'mimic3 --voice fa/haaniye_low "{text}" > {fp.name}', shell=True, stderr=subprocess.STDOUT)
return fp.name
article= ""
iface = gr.Interface(
fn=tts,
inputs=[
gr.Textbox(
label="Input",
)
],
outputs=gr.Audio(label="Output",type='filepath')
)
iface.launch()