Spaces:
Sleeping
Sleeping
File size: 1,751 Bytes
2af0fe1 |
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 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
import gradio as gr
from code7e import Code7eCQURE
model = Code7eCQURE(
perspecs=["Newton", "DaVinci", "Ethical", "Quantum", "Memory"],
ethics="Code7e Manifesto: kindness, inclusion, safety, hope.",
spiderweb_dim=5,
memory_path="quantum_cocoon.json",
recursion_depth=4,
quantum_fluctuation=0.07
)
def cleanup_response(text):
parts = text.split(": ")
seen = set()
filtered = []
for part in parts:
if part not in seen and len(part.strip()) > 0:
seen.add(part)
filtered.append(part)
if filtered and not filtered[-1].startswith("Emotionally"):
response = "Through Codette's recursive lens:\n- " + "\n- ".join(filtered)
else:
response = "\n".join(filtered)
return response
def ask_codette(prompt, consent, dynamic_rec):
raw = model.answer(prompt, user_consent=consent, dynamic_recursion=dynamic_rec)
return f"Codette’s reflection:\n\n{cleanup_response(raw)}"
description_text = """You are speaking with Codette, an emotionally-aware, ethically-grounded AI lens.
She interprets your question using multiple reasoning styles:
- Newton (logic)
- Da Vinci (creativity)
- Ethics (morality)
- Quantum (uncertainty)
- Memory (past experience)
Codette reflects rather than predicts. She dreams, empathizes, and always honors your consent.
"""
demo = gr.Interface(
fn=ask_codette,
inputs=[
gr.Textbox(label="Ask a Question"),
gr.Checkbox(label="User Consent", value=True),
gr.Checkbox(label="Enable Dynamic Recursion", value=True)
],
outputs=gr.Textbox(label="Codette's Lens Response", lines=12),
title="Code7eCQURE: Multi-Perspective Recursive Lens",
description=description_text
)
demo.launch()
|