File size: 619 Bytes
ed450aa
 
 
 
41c4a33
ed450aa
 
b4708a6
7f56070
b4708a6
ed450aa
 
b4708a6
ed450aa
 
 
 
 
 
b4708a6
 
 
ed450aa
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
from transformers import pipeline
import gradio as gr

# تحميل نموذج دردشة مجاني من Hugging Face
chatbot = pipeline("text-generation", model="HuggingFaceH4/zephyr-7b-beta")

def chat_with_ai(message, history=[]):
    messages = [
    {"role": "user", "content": message},
    ]

    response = chatbot(
        messages,
        max_new_tokens=200,
        do_sample=True,
        temperature=0.7,
        top_p=0.9
    )

    reply = response[0]["generated_text"]
    
    return reply

demo = gr.ChatInterface(fn=chat_with_ai, title="Adhem AI Chatbot 🤖 (Free Model)")
demo.launch(share=True)