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