Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -10,6 +10,22 @@ model = Code7eCQURE(
|
|
| 10 |
quantum_fluctuation=0.07
|
| 11 |
)
|
| 12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
def ask_codette(prompt, consent, dynamic_rec):
|
| 14 |
raw = model.answer(prompt, user_consent=consent, dynamic_recursion=dynamic_rec)
|
| 15 |
return f"Codette’s reflection:\n\n{cleanup_response(raw)}"
|
|
@@ -33,9 +49,3 @@ demo = gr.Interface(
|
|
| 33 |
gr.Checkbox(label="User Consent", value=True),
|
| 34 |
gr.Checkbox(label="Enable Dynamic Recursion", value=True)
|
| 35 |
],
|
| 36 |
-
outputs=gr.Textbox(label="Codette's Lens Response", lines=12),
|
| 37 |
-
title="Code7eCQURE: Multi-Perspective Recursive Lens",
|
| 38 |
-
description=description_text
|
| 39 |
-
)
|
| 40 |
-
|
| 41 |
-
demo.launch()
|
|
|
|
| 10 |
quantum_fluctuation=0.07
|
| 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 = "\n".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)}"
|
|
|
|
| 49 |
gr.Checkbox(label="User Consent", value=True),
|
| 50 |
gr.Checkbox(label="Enable Dynamic Recursion", value=True)
|
| 51 |
],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|