Spaces:
Sleeping
Sleeping
File size: 765 Bytes
e4d14e4 fe6b6c1 e4d14e4 fe6b6c1 e4d14e4 fe6b6c1 e4d14e4 fe6b6c1 e4d14e4 fe6b6c1 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
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.</s><|user|>{message}</s><|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() |