Spaces:
Sleeping
Sleeping
File size: 816 Bytes
dc63402 2df2460 072932a 2df2460 072932a 2df2460 20b9745 2df2460 b939b98 2df2460 072932a 89a913a 2df2460 dc63402 | 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 | 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() |