Spaces:
Sleeping
Sleeping
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() | |