Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,21 +1,20 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from TTS_X.tts import generate_voice
|
|
|
|
|
|
|
| 3 |
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
print(TTS().list_models())
|
| 8 |
-
|
| 9 |
-
def inference(text):
|
| 10 |
-
output_path = generate_voice(text, DEFAULT_SPEAKER_WAV, language="ar")
|
| 11 |
-
return "تم التحويل بنجاح", output_path
|
| 12 |
|
| 13 |
gr.Interface(
|
| 14 |
-
fn=
|
| 15 |
-
inputs=
|
| 16 |
-
|
| 17 |
-
gr.
|
| 18 |
-
gr.Audio(label="الصوت الناتج")
|
| 19 |
],
|
| 20 |
-
|
|
|
|
|
|
|
| 21 |
).launch()
|
|
|
|
|
|
| 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 |
+
|