wedyanessam commited on
Commit
e682a2e
·
verified ·
1 Parent(s): d3f638a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -14
app.py CHANGED
@@ -1,20 +1,19 @@
1
  import gradio as gr
2
  from TTS_X.tts import generate_voice
3
- import gradio as gr
4
- from openai_tts import generate_audio_from_text
5
 
6
- def tts_interface(text, voice):
7
- audio_path = generate_audio_from_text(text, voice)
8
  return audio_path
9
 
10
- gr.Interface(
11
- fn=tts_interface,
12
- inputs=[
13
- gr.Textbox(label="اكتب النص هنا", placeholder="مثال: أهلاً وسهلاً!"),
14
- gr.Dropdown(["onyx", "nova", "echo", "fable", "alloy"], label="اختيار الصوت", value="onyx")
15
- ],
16
- outputs=gr.Audio(label="الصوت الناتج", type="filepath"),
17
- title="🔊 OpenAI TTS بالعربي",
18
- description="تحويل النص إلى صوت باستخدام نموذج OpenAI TTS"
19
- ).launch()
 
20
 
 
1
  import gradio as gr
2
  from TTS_X.tts import generate_voice
 
 
3
 
4
+ def tts_interface(text):
5
+ audio_path = generate_voice(text)
6
  return audio_path
7
 
8
+ with gr.Blocks() as demo:
9
+ gr.Markdown("## 🎤 Text to Speech using OpenAI TTS (Nova Voice)")
10
+ with gr.Row():
11
+ txt = gr.Textbox(label="اكتب نصك هنا")
12
+ btn = gr.Button("حوّل إلى صوت")
13
+ audio_output = gr.Audio(label="الصوت الناتج")
14
+
15
+ btn.click(fn=tts_interface, inputs=txt, outputs=audio_output)
16
+
17
+ demo.launch()
18
+
19