File size: 599 Bytes
ed4d752 99c6dce ed4d752 99c6dce ed4d752 99c6dce ed4d752 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
import gradio as gr
from transformers import FastSpeechForConditionalGeneration, Wav2Vec2Processor
# تحميل النموذج والمعالج
model = FastSpeechForConditionalGeneration.from_pretrained("facebook/fastspeech2-en-ljspeech")
processor = Wav2Vec2Processor.from_pretrained("facebook/fastspeech2-en-ljspeech")
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="FastSpeech2 Najdi TTS Model")
iface.launch()
|