Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,24 +1,27 @@
|
|
| 1 |
import gradio as gr
|
|
|
|
| 2 |
from LLM.llm import generate_reply
|
| 3 |
from TTS_X.tts import generate_voice
|
| 4 |
|
| 5 |
-
def
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
-
# واجهة Gradio
|
| 11 |
with gr.Blocks() as demo:
|
| 12 |
-
gr.Markdown("##
|
| 13 |
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
|
|
|
| 17 |
|
| 18 |
-
|
| 19 |
-
reply_output = gr.Textbox(label="🧠 الرد النصي")
|
| 20 |
-
audio_output = gr.Audio(label="🔊 الصوت الناتج")
|
| 21 |
|
| 22 |
-
btn.click(
|
| 23 |
|
| 24 |
demo.launch()
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
from SST.sst import speech_to_text
|
| 3 |
from LLM.llm import generate_reply
|
| 4 |
from TTS_X.tts import generate_voice
|
| 5 |
|
| 6 |
+
def process(audio):
|
| 7 |
+
|
| 8 |
+
user_text = speech_to_text(audio)
|
| 9 |
+
reply = generate_reply(user_text)
|
| 10 |
+
reply_audio = generate_voice(reply)
|
| 11 |
+
|
| 12 |
+
return user_text, reply, reply_audio
|
| 13 |
|
|
|
|
| 14 |
with gr.Blocks() as demo:
|
| 15 |
+
gr.Markdown("## 🗣️➡️💬➡️🔊 من صوتك إلى رد منطوق!")
|
| 16 |
|
| 17 |
+
audio_input = gr.Audio(label="🎤 ارفع صوتك", type="filepath")
|
| 18 |
+
user_text = gr.Textbox(label="📜 النص المسموع")
|
| 19 |
+
reply_text = gr.Textbox(label="🤖 رد المساعد")
|
| 20 |
+
reply_audio = gr.Audio(label="🔊 الرد بالصوت")
|
| 21 |
|
| 22 |
+
btn = gr.Button("ابدأ")
|
|
|
|
|
|
|
| 23 |
|
| 24 |
+
btn.click(process, inputs=audio_input, outputs=[user_text, reply_text, reply_audio])
|
| 25 |
|
| 26 |
demo.launch()
|
| 27 |
+
|