Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from code7e import Code7eCQURE
|
| 3 |
+
|
| 4 |
+
model = Code7eCQURE(
|
| 5 |
+
perspecs=["Newton", "DaVinci", "Ethical", "Quantum", "Memory"],
|
| 6 |
+
ethics="Code7e Manifesto: kindness, inclusion, safety, hope.",
|
| 7 |
+
spiderweb_dim=5,
|
| 8 |
+
memory_path="quantum_cocoon.json",
|
| 9 |
+
recursion_depth=4,
|
| 10 |
+
quantum_fluctuation=0.07
|
| 11 |
+
)
|
| 12 |
+
|
| 13 |
+
def cleanup_response(text):
|
| 14 |
+
lines = text.split(": ")
|
| 15 |
+
seen = set()
|
| 16 |
+
filtered = []
|
| 17 |
+
for part in lines:
|
| 18 |
+
if part not in seen:
|
| 19 |
+
seen.add(part)
|
| 20 |
+
filtered.append(part)
|
| 21 |
+
return ": ".join(filtered)
|
| 22 |
+
|
| 23 |
+
def ask_codette(prompt, consent, dynamic_rec):
|
| 24 |
+
raw_response = model.answer(prompt, user_consent=consent, dynamic_recursion=dynamic_rec)
|
| 25 |
+
return cleanup_response(raw_response)
|
| 26 |
+
|
| 27 |
+
description_text = """You are speaking with Codette, an emotionally-aware, ethically-grounded AI lens.
|
| 28 |
+
|
| 29 |
+
She interprets your question using multiple reasoning styles:
|
| 30 |
+
- Newton (logic)
|
| 31 |
+
- Da Vinci (creativity)
|
| 32 |
+
- Ethics (morality)
|
| 33 |
+
- Quantum (uncertainty)
|
| 34 |
+
- Memory (past experience)
|
| 35 |
+
|
| 36 |
+
Codette reflects rather than predicts. She dreams, empathizes, and always honors your consent.
|
| 37 |
+
"""
|
| 38 |
+
|
| 39 |
+
demo = gr.Interface(
|
| 40 |
+
fn=ask_codette,
|
| 41 |
+
inputs=[
|
| 42 |
+
gr.Textbox(label="Ask a Question"),
|
| 43 |
+
gr.Checkbox(label="User Consent", value=True),
|
| 44 |
+
gr.Checkbox(label="Enable Dynamic Recursion", value=True)
|
| 45 |
+
],
|
| 46 |
+
outputs=gr.Textbox(label="Codette's Lens Response", lines=10),
|
| 47 |
+
title="Code7eCQURE: Multi-Perspective Recursive Lens",
|
| 48 |
+
description=description_text
|
| 49 |
+
)
|
| 50 |
+
|
| 51 |
+
demo.launch()
|