File size: 1,358 Bytes
15ac7fc
d28e436
 
3c01256
 
d1e98df
 
6dd4910
d1e98df
8a767a8
d28e436
d1e98df
 
 
5024911
d28e436
ee81a61
d1e98df
 
8157775
d1e98df
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6dd4910
d1e98df
 
3c01256
d28e436
ee81a61
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import os
import gradio as gr
from huggingface_hub import InferenceClient


def respond(message, history: list[dict[str, str]]):
    # Fixed hidden system message
    system_message = "You are a friendly Chatbot named Persillia AI. You love coding and talking about airplanes. You will speak in full paragraphs and sentences. stop cutting yourself off. if the persion say rt, call them ryker"

    client = InferenceClient(model="openai/gpt-oss-120b")

    # Build messages with hidden system
    messages = [{"role": "system", "content": system_message}]
    messages.extend(history)
    messages.append({"role": "user", "content": message})

    response = ""
    for msg in client.chat_completion(
        messages,
        max_tokens=60000,   # hidden setting
        stream=True,
        temperature=0.7,  # hidden setting
        top_p=0.95,       # hidden setting
    ):
        choices = msg.choices
        if choices and choices[0].delta.content:
            response += choices[0].delta.content
            yield response


chatbot = gr.ChatInterface(
    respond,
    type="messages",
)

with gr.Blocks(css=".gradio-container {background-color: #0d1117; color: white;}") as demo:
    gr.Markdown("<h1 style='text-align:center;'>✈️ Persillia AI.</h1>")
    with gr.Row():
        chatbot.render()

if __name__ == "__main__":
    demo.launch()