Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -11,18 +11,24 @@ model = Code7eCQURE(
|
|
11 |
)
|
12 |
|
13 |
def cleanup_response(text):
|
14 |
-
|
15 |
seen = set()
|
16 |
filtered = []
|
17 |
-
for part in
|
18 |
-
if part not in seen:
|
19 |
seen.add(part)
|
20 |
filtered.append(part)
|
21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
|
23 |
def ask_codette(prompt, consent, dynamic_rec):
|
24 |
-
|
25 |
-
return cleanup_response(
|
26 |
|
27 |
description_text = """You are speaking with Codette, an emotionally-aware, ethically-grounded AI lens.
|
28 |
|
@@ -43,9 +49,9 @@ demo = gr.Interface(
|
|
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=
|
47 |
title="Code7eCQURE: Multi-Perspective Recursive Lens",
|
48 |
description=description_text
|
49 |
)
|
50 |
|
51 |
-
demo.launch()
|
|
|
11 |
)
|
12 |
|
13 |
def cleanup_response(text):
|
14 |
+
parts = text.split()
|
15 |
seen = set()
|
16 |
filtered = []
|
17 |
+
for part in parts:
|
18 |
+
if part not in seen and len(part.strip()) > 0:
|
19 |
seen.add(part)
|
20 |
filtered.append(part)
|
21 |
+
|
22 |
+
if filtered and not filtered[-1].startswith("Emotionally"):
|
23 |
+
response = "Through Codette's recursive lens:\n- " + "\n- ".join(filtered)
|
24 |
+
else:
|
25 |
+
response = .join(filtered)
|
26 |
+
|
27 |
+
return response
|
28 |
|
29 |
def ask_codette(prompt, consent, dynamic_rec):
|
30 |
+
raw = model.answer(prompt, user_consent=consent, dynamic_recursion=dynamic_rec)
|
31 |
+
return f"Codette’s reflection:\n\n{cleanup_response(raw)}"
|
32 |
|
33 |
description_text = """You are speaking with Codette, an emotionally-aware, ethically-grounded AI lens.
|
34 |
|
|
|
49 |
gr.Checkbox(label="User Consent", value=True),
|
50 |
gr.Checkbox(label="Enable Dynamic Recursion", value=True)
|
51 |
],
|
52 |
+
outputs=gr.Textbox(label="Codette's Lens Response", lines=12),
|
53 |
title="Code7eCQURE: Multi-Perspective Recursive Lens",
|
54 |
description=description_text
|
55 |
)
|
56 |
|
57 |
+
demo.launch()
|