|
import gradio as gr |
|
from transformers import pipeline |
|
|
|
|
|
MODEL_NAME = "ABD20124082402/Islamic-Ai" |
|
chatbot = pipeline("text-generation", model=MODEL_NAME) |
|
|
|
|
|
def chat(message, history): |
|
response = chatbot(message, max_length=100) |
|
return response[0]["generated_text"] |
|
|
|
|
|
with gr.Blocks(theme=gr.themes.Soft()) as demo: |
|
gr.Markdown("# 🤖 **بوت المحادثات الإسلامية**") |
|
gr.Markdown("### اسأل أي سؤال وسيتم الرد عليك بناءً على الذكاء الاصطناعي الإسلامي.") |
|
|
|
with gr.Row(): |
|
with gr.Column(scale=3): |
|
chatbot_ui = gr.Chatbot() |
|
with gr.Column(scale=1): |
|
msg_input = gr.Textbox(label="✍️ اكتب سؤالك هنا", placeholder="مثال: ما هي أركان الإسلام؟") |
|
send_btn = gr.Button("🚀 إرسال") |
|
|
|
send_btn.click(chat, inputs=[msg_input, chatbot_ui], outputs=chatbot_ui) |
|
|
|
|
|
demo.launch() |