tts / app.py
m6011's picture
Create app.py
ed4d752 verified
raw
history blame
559 Bytes
import gradio as gr
from transformers import Tacotron2Processor, Tacotron2ForConditionalGeneration
# تحميل النموذج والمعالج
processor = Tacotron2Processor.from_pretrained("facebook/tacotron2")
model = Tacotron2ForConditionalGeneration.from_pretrained("facebook/tacotron2")
def tts(text):
inputs = processor(text, return_tensors="pt")
speech = model.generate(**inputs)
return processor.decode(speech[0])
# واجهة Gradio
iface = gr.Interface(fn=tts, inputs="text", outputs="audio", title="Najdi TTS Model")
iface.launch()