yousef4 commited on
Commit
28128b2
·
verified ·
1 Parent(s): fbc6abc

Create main.py

Browse files
Files changed (1) hide show
  1. main.py +26 -0
main.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from gradio_client import Client, handle_file
3
+
4
+ def egyptian_tts(text, speaker_audio, temperature):
5
+ client = Client("MohamedRashad/Egyptian-Arabic-TTS")
6
+ result = client.predict(
7
+ text=text,
8
+ speaker_audio_path=handle_file(speaker_audio),
9
+ temperature=temperature,
10
+ api_name="/infer_EGTTS"
11
+ )
12
+ return result # ملف الصوت الناتج
13
+
14
+ iface = gr.Interface(
15
+ fn=egyptian_tts,
16
+ inputs=[
17
+ gr.Textbox(label="النص المراد تحويله إلى صوت"),
18
+ gr.Audio(type="filepath", label="رفع عينة صوتية للمتحدث"),
19
+ gr.Slider(minimum=0.1, maximum=1.0, value=0.75, label="درجة العشوائية")
20
+ ],
21
+ outputs=gr.Audio(label="الصوت الناتج"),
22
+ title="نسخ الصوت بالذكاء الاصطناعي",
23
+ description=""
24
+ )
25
+
26
+ iface.launch()