import gradio as gr from huggingface_hub import InferenceClient # ده المحرك اللي بيفكر وبيبرمج client = InferenceClient("Qwen/Qwen2.5-Coder-32B-Instruct") def generate_code(idea): # بنقول للذكاء الاصطناعي يبرمج فكرتك فوراً prompt = f"Write a complete, ready-to-use code for: {idea}. Only output the code." response = "" for message in client.chat_completion([{"role": "user", "content": prompt}], max_tokens=3000, stream=True): response += message.choices[0].delta.content return response # شكل الموقع بتاعك with gr.Blocks() as demo: gr.Markdown("# 🚀 مبرمج كرم الذكي") gr.Markdown("اكتب فكرتك وسأقوم ببرمجتها لك في ثوانٍ!") idea = gr.Textbox(label="ماذا تريد أن أصنع لك؟", placeholder="مثلاً: لعبة ثعبان بلغة Python") btn = gr.Button("ابدأ البرمجة الآن") result = gr.Code(label="الكود الناتج") btn.click(fn=generate_code, inputs=idea, outputs=result) demo.launch()