Spaces:
Sleeping
Sleeping
File size: 755 Bytes
fcf3782 1e96a52 f4ff040 fcf3782 f4ff040 56caa10 ab3e784 f4ff040 ab3e784 56caa10 ab3e784 f4ff040 fcf3782 56caa10 fcf3782 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
import gradio as gr
from models.tacotron2 import Tacotron2Wave
model = Tacotron2Wave('pretrained/tacotron2_ar_adv.pth')
#model = model.cuda()
import re
def clean_text(text):
# حذف الأرقام والحروف الإنجليزية والنقطة
cleaned_text = re.sub(r"[0-9a-zA-Z\.]", " ", text)
return cleaned_text
def greet(text):
text=clean_text(text).strip()
for t in text.split(' '):
try:
if t.strip()!='':
wave = model.tts(t,vowelizer='shakkelha')
yield 22025,wave.view(-1).cpu().numpy()
except error:pass
demo = gr.Interface(fn=greet, inputs="text", outputs="audio")
demo.launch()
|