File size: 726 Bytes
d9d25fe
c79816c
9dd7b34
 
d9d25fe
9dd7b34
 
 
d9d25fe
cac46bd
9dd7b34
 
 
 
cac46bd
9dd7b34
 
 
cac46bd
9dd7b34
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import gradio as gr
from TTS_X.tts import generate_voice
import gradio as gr
from openai_tts import generate_audio_from_text

def tts_interface(text, voice):
    audio_path = generate_audio_from_text(text, voice)
    return audio_path

gr.Interface(
    fn=tts_interface,
    inputs=[
        gr.Textbox(label="اكتب النص هنا", placeholder="مثال: أهلاً وسهلاً!"),
        gr.Dropdown(["onyx", "nova", "echo", "fable", "alloy"], label="اختيار الصوت", value="onyx")
    ],
    outputs=gr.Audio(label="الصوت الناتج", type="filepath"),
    title="🔊 OpenAI TTS بالعربي",
    description="تحويل النص إلى صوت باستخدام نموذج OpenAI TTS"
).launch()