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()