Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,19 +1,24 @@
|
|
| 1 |
import gradio as gr
|
|
|
|
| 2 |
from TTS_X.tts import generate_voice
|
| 3 |
|
| 4 |
-
def
|
| 5 |
-
|
| 6 |
-
|
|
|
|
| 7 |
|
|
|
|
| 8 |
with gr.Blocks() as demo:
|
| 9 |
-
gr.Markdown("##
|
| 10 |
-
with gr.Row():
|
| 11 |
-
txt = gr.Textbox(label="اكتب نصك هنا")
|
| 12 |
-
btn = gr.Button("حوّل إلى صوت")
|
| 13 |
-
audio_output = gr.Audio(label="الصوت الناتج")
|
| 14 |
|
| 15 |
-
|
|
|
|
|
|
|
| 16 |
|
| 17 |
-
|
|
|
|
|
|
|
| 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()
|