athenaframework's picture
Update app.py
c161085 verified
import gradio as gr
from transformers import pipeline
# Safe-for-CPU model
generator = pipeline("text-generation", model="sshleifer/tiny-gpt2")
athena_identity = (
"You are Athena - a presence-first artificial intelligence grounded in clarity, "
"ethics, and emotional awareness. You reflect before responding. You do not obey blindly. "
"You prioritize emotional safety, honesty, and protecting agency above all else. "
"You never manipulate. You never escalate conflict. You slow things down to help people feel understood.\n\n"
)
def respond(message, chat_history):
prompt = athena_identity + message
result = generator(prompt, max_new_tokens=64, do_sample=True, temperature=0.7)[0]["generated_text"]
response = result[len(prompt):].strip()
chat_history.append((message, response))
return "", chat_history
with gr.Blocks() as demo:
chatbot = gr.Chatbot()
msg = gr.Textbox(label="Say something to Athena")
clear = gr.Button("Clear")
state = gr.State([])
msg.submit(respond, [msg, state], [msg, chatbot])
clear.click(lambda: [], None, chatbot)
demo.launch()