|
|
import gradio as gr
|
|
|
from transformers import pipeline
|
|
|
|
|
|
|
|
|
pipe = pipeline("text-generation", model="Zenkad/zenkaMind-1.1B", device_map="auto")
|
|
|
|
|
|
def sohbet(message, history):
|
|
|
prompt = f"<|system|>\nSen ZenkaMind'sin. Türk genci gibi konuş.</s>\n<|user|>\n{message}</s>\n<|assistant|>\n"
|
|
|
result = pipe(prompt, max_new_tokens=60, temperature=0.9)[0]["generated_text"]
|
|
|
cevap = result.split("<|assistant|>\n")[-1].strip()
|
|
|
history.append([message, cevap])
|
|
|
return history, ""
|
|
|
|
|
|
|
|
|
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
|
gr.Markdown("# zenkaMind 1.1B\n**senin gibi konuşur, 1 saniyede cevap verir!**")
|
|
|
chatbot = gr.Chatbot(height=500)
|
|
|
msg = gr.Textbox(placeholder="selam canımm...", label="Sen:")
|
|
|
msg.submit(sohbet, [msg, chatbot], [chatbot, msg])
|
|
|
|
|
|
demo.launch() |