wedyanessam commited on
Commit
769c7b4
·
verified ·
1 Parent(s): c3dbcf0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -10
app.py CHANGED
@@ -1,19 +1,24 @@
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
 
 
 
1
  import gradio as gr
2
+ from LLM.llm import generate_reply
3
  from TTS_X.tts import generate_voice
4
 
5
+ def chat_and_tts(user_input):
6
+ reply = generate_reply(user_input)
7
+ audio = generate_voice(reply)
8
+ return reply, audio
9
 
10
+ # واجهة Gradio
11
  with gr.Blocks() as demo:
12
+ gr.Markdown("## 🤖💬 Chat & TTS Assistant using OpenAI (GPT + Nova Voice)")
 
 
 
 
13
 
14
+ with gr.Row():
15
+ txt = gr.Textbox(label="📝 اكتب سؤالك أو طلبك")
16
+ btn = gr.Button("أرسل")
17
 
18
+ with gr.Row():
19
+ reply_output = gr.Textbox(label="🧠 الرد النصي")
20
+ audio_output = gr.Audio(label="🔊 الصوت الناتج")
21
 
22
+ btn.click(fn=chat_and_tts, inputs=txt, outputs=[reply_output, audio_output])
23
 
24
+ demo.launch()