Spaces:
Runtime error
Runtime error
| import gradio as gr | |
| from STT.sst import speech_to_text | |
| from LLM.llm import generate_reply | |
| from TTS_X.tts import generate_voice | |
| def process(audio): | |
| user_text = speech_to_text(audio) | |
| reply = generate_reply(user_text) | |
| reply_audio = generate_voice(reply) | |
| return user_text, reply, reply_audio | |
| with gr.Blocks() as demo: | |
| gr.Markdown("## 🗣️➡️💬➡️🔊 من صوتك إلى رد منطوق!") | |
| audio_input = gr.Audio(label="🎤 ارفع صوتك", type="filepath") | |
| user_text = gr.Textbox(label="📜 النص المسموع") | |
| reply_text = gr.Textbox(label="🤖 رد المساعد") | |
| reply_audio = gr.Audio(label="🔊 الرد بالصوت") | |
| btn = gr.Button("ابدأ") | |
| btn.click(process, inputs=audio_input, outputs=[user_text, reply_text, reply_audio]) | |
| demo.launch() | |