Spaces:
Running
Running
Delete index.html
#1
by
ahmedfgrff
- opened
- index.html +0 -44
index.html
DELETED
|
@@ -1,44 +0,0 @@
|
|
| 1 |
-
تطبيق عَرِبِي - تحويل النص إلى كلام باللهجة السعودية
|
| 2 |
-
|
| 3 |
-
نسخة مفتوحة المصدر قابلة للنشر على Hugging Face
|
| 4 |
-
|
| 5 |
-
import gradio as gr import subprocess import uuid import os
|
| 6 |
-
|
| 7 |
-
AVAILABLE_VOICES = { "سعودي شبابي": "ayymen/coqui-tts-vits-shi", "فصحى نسائي": "tts_models/ar/mai/tts", "إنجليزي واقعي": "tts_models/en/ljspeech/glow-tts" }
|
| 8 |
-
|
| 9 |
-
def generate_tts(prompt, voice_key): if not prompt: return "الرجاء إدخال نص."
|
| 10 |
-
|
| 11 |
-
model_name = AVAILABLE_VOICES.get(voice_key)
|
| 12 |
-
if not model_name:
|
| 13 |
-
return "الصوت المحدد غير متوفر."
|
| 14 |
-
|
| 15 |
-
filename = f"output_{uuid.uuid4().hex}.wav"
|
| 16 |
-
command = f"tts --text '{prompt.replace("'", "")}' --model_name {model_name} --out_path {filename}"
|
| 17 |
-
|
| 18 |
-
try:
|
| 19 |
-
subprocess.run(command, shell=True, check=True)
|
| 20 |
-
return filename
|
| 21 |
-
except subprocess.CalledProcessError as e:
|
| 22 |
-
return f"حدث خطأ أثناء توليد الصوت: {str(e)}"
|
| 23 |
-
|
| 24 |
-
def arabic_ui(): with gr.Blocks(title="عَرِبِي - تحويل النص إلى كلام") as app: gr.Markdown(""" <div style="text-align: center"> <h1 style="font-size: 2.5em; color: #1e293b">عَرِبِي</h1> <p style="font-size: 1.2em;">حوّل النصوص العربية إلى صوت واقعي باللهجة السعودية</p> </div> """)
|
| 25 |
-
|
| 26 |
-
with gr.Row():
|
| 27 |
-
prompt = gr.Textbox(label="النص العربي", placeholder="اكتب هنا كلامك...", lines=4)
|
| 28 |
-
|
| 29 |
-
with gr.Row():
|
| 30 |
-
voice_key = gr.Dropdown(label="اختر الصوت", choices=list(AVAILABLE_VOICES.keys()), value="سعودي شبابي")
|
| 31 |
-
|
| 32 |
-
generate_btn = gr.Button("حوّل إلى صوت")
|
| 33 |
-
audio_output = gr.Audio(label="الصوت الناتج")
|
| 34 |
-
|
| 35 |
-
generate_btn.click(
|
| 36 |
-
fn=generate_tts,
|
| 37 |
-
inputs=[prompt, voice_key],
|
| 38 |
-
outputs=audio_output
|
| 39 |
-
)
|
| 40 |
-
|
| 41 |
-
return app
|
| 42 |
-
|
| 43 |
-
arabic_ui().launch()
|
| 44 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|