wedyanessam's picture
Update app.py
cac46bd verified
raw
history blame
727 Bytes
import gradio as gr
from TTS.tts import generate_voice
def inference(text, speaker_wav):
if speaker_wav is None:
return "يرجى رفع ملف صوت لشخص تريد تقليد صوته", None
output_path = generate_voice(text, speaker_wav.name, language="ar")
return "تم التحويل بنجاح", output_path
gr.Interface(
fn=inference,
inputs=[
gr.Textbox(label="النص العربي"),
gr.Audio(source="upload", type="file", label="ملف صوت للشخص (WAV)")
],
outputs=[
gr.Textbox(label="النتيجة"),
gr.Audio(label="الصوت الناتج")
],
title="🔊 تحويل نص إلى صوت باستخدام XTTS v2"
).launch()