Spaces:
Sleeping
Sleeping
Download app.py from PhaseDOutAI/Persilia-AI: direct link, hf CLI and curl.
- Browser
- Download file 1.36 kB
-
https://huggingface.co/spaces/PhaseDOutAI/Persilia-AI/resolve/main/app.py
- Command line
-
hf download hf://spaces/PhaseDOutAI/Persilia-AI/app.py
-
curl -L -o app.py https://huggingface.co/spaces/PhaseDOutAI/Persilia-AI/resolve/main/app.py
1.36 kB
| 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() | |