Spaces:
Sleeping
Sleeping
File size: 628 Bytes
fcf3782 1e96a52 f4ff040 fcf3782 f4ff040 56caa10 f4ff040 56caa10 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 |
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):
try:
text=clean_text(text).strip()
wave = model.tts(text,vowelizer='shakkelha')
return 22025,wave.view(-1).cpu().numpy()
except error:
return None
demo = gr.Interface(fn=greet, inputs="text", outputs="audio")
demo.launch()
|