Spaces:
Sleeping
Sleeping
File size: 772 Bytes
f1f8304 b0a664c f1f8304 aff16c3 b0a664c aff16c3 f1f8304 b0a664c f1f8304 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
import gradio as gr
from transformers import pipeline
# نموذج عربي مفتوح وخفيف
chatbot = pipeline("text-generation", model="akhooli/gpt2-small-arabic", tokenizer="akhooli/gpt2-small-arabic")
def chat(message, history=[]):
prompt = f"المحادثة:\nالمستخدم: {message}\nالمساعد:"
response = chatbot(prompt, max_length=80, num_return_sequences=1, do_sample=True, temperature=0.7)[0]["generated_text"]
reply = response.split("المساعد:")[-1].strip()
history.append((message, reply))
return history, history
with gr.Blocks() as demo:
gr.ChatInterface(fn=chat, title="شات عربي مجاني", description="بوت دردشة عربي مبسط يعمل عبر Hugging Face", theme="soft")
demo.launch()
|