import gradio as gr from transformers import pipeline # بارگذاری مدل DeepSeek-Coder coder = pipeline("text-generation", model="deepseek-ai/deepseek-coder-33b-instruct") def respond(message, history): prompt = f"<|system|>You are an expert programming assistant. Use Persian when needed.<|user|>{message}<|assistant|>" response = coder(prompt, max_new_tokens=200)[0]['generated_text'] return response.split("<|assistant|>")[-1].strip() # استفاده از تمپلت آماده Chat Interface gr.ChatInterface( respond, title="👨‍💻 دستیار کدنویسی شما", examples=["چطوری در React از useState استفاده کنم؟", "خطای SyntaxError در پایتون را رفع کن"] ).launch()