Adhem88's picture
Update app.py
58210ed verified
raw
history blame contribute delete
619 Bytes
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)