xTHExBEASTx commited on
Commit
9acea99
·
verified ·
1 Parent(s): fd74314

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -28
app.py CHANGED
@@ -1,29 +1,5 @@
1
- import gradio as gr
2
- from habibi_tts import HabibiTTS
3
 
4
- # حمل النموذج (Unified أو variant اللي عايزه)
5
- tts = HabibiTTS.from_pretrained("SWivid/Habibi-TTS", variant="Unified") # غير لـ "SAU" أو "EG" لو عايز لهجة معينة
6
-
7
- def synthesize(text, dialect="Unified"):
8
- if dialect == "Unified":
9
- variant = "Unified"
10
- elif dialect == "Egyptian":
11
- variant = "EG" # أو حسب المتوفر
12
- else:
13
- variant = "Unified"
14
-
15
- audio = tts.synthesize(text=text)
16
- return (22050, audio) # sample rate 22050
17
-
18
- iface = gr.Interface(
19
- fn=synthesize,
20
- inputs=[
21
- gr.Textbox(label="اكتب النص العربي هنا", placeholder="مرحبا حبيبي، إزيك النهاردة؟"),
22
- gr.Dropdown(choices=["Unified", "Egyptian", "Gulf", "Maghrebi"], label="اللهجة", value="Unified")
23
- ],
24
- outputs=gr.Audio(label="الصوت الناتج"),
25
- title="Habibi-TTS - تجربة اللهجات العربية",
26
- description="نموذج Habibi-TTS لتحويل النص إلى صوت عربي بدلهجات مختلفة."
27
- )
28
-
29
- iface.launch()
 
1
+ import os
2
+ import subprocess
3
 
4
+ # شغل الـ infer-gradio كـ main process
5
+ os.system("habibi-tts_infer-gradio --port 7860 --server-name 0.0.0.0")