Testkai / app.py
Hulk810154's picture
Update app.py
2df2460 verified
raw
history blame contribute delete
816 Bytes
import gradio as gr
from transformers import pipeline
# β€”β€”β€” Initialize your model pipeline β€”β€”β€”
chat_pipe = pipeline(
"text-generation",
model="Hulk810154/Kai",
trust_remote_code=True
) # Uses your HF model directly 4
# β€”β€”β€” Chat handler β€”β€”β€”
def chat_fn(message, history):
if history is None:
history = []
# Append user message, get generation, then append AI reply
output = chat_pipe(message, max_new_tokens=128, do_sample=True)[0]["generated_text"]
history.append((message, output))
return history, history
# β€”β€”β€” Build and launch Gradio chat UI β€”β€”β€”
demo = gr.ChatInterface(
fn=chat_fn,
title="🧠 Kai AGI Text Chat",
description="Text-only chat with the Hulk810154/Kai model on Hugging Face Spaces."
)
demo.launch()