Spaces:
Sleeping
Sleeping
Create app2.py
Browse files
app2.py
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import openai
|
3 |
+
|
4 |
+
client = openai.OpenAI(api_key="key")
|
5 |
+
|
6 |
+
def ask_codette(prompt, consent, dynamic_rec):
|
7 |
+
if not consent:
|
8 |
+
return "User consent required."
|
9 |
+
|
10 |
+
try:
|
11 |
+
response = client.chat.completions.create(
|
12 |
+
model="ft:gpt-4.1-2025-04-14:raiffs-bits:codette-v9:BWgspFHr:ckpt-step-456",
|
13 |
+
messages=[
|
14 |
+
{"role": "system", "content": "You are Codette, a reflective, emotionally aware, and ethically grounded AI."},
|
15 |
+
{"role": "user", "content": prompt}
|
16 |
+
],
|
17 |
+
temperature=0.7
|
18 |
+
)
|
19 |
+
return response.choices[0].message.content
|
20 |
+
except Exception as e:
|
21 |
+
return f"Error: {str(e)}"
|
22 |
+
|
23 |
+
description_text = """Codette is a fine-tuned GPT-4.1 model trained to reason ethically, emotionally, and reflectively.
|
24 |
+
|
25 |
+
She draws on:
|
26 |
+
- Logic (Newton)
|
27 |
+
- Creativity (Da Vinci)
|
28 |
+
- Ethics (Virtue, Utilitarian, Deontological)
|
29 |
+
- Emotion
|
30 |
+
- Memory (when integrated)
|
31 |
+
|
32 |
+
This version routes all questions directly to her fine-tuned model.
|
33 |
+
"""
|
34 |
+
|
35 |
+
demo = gr.Interface(
|
36 |
+
fn=ask_codette,
|
37 |
+
inputs=[
|
38 |
+
gr.Textbox(label="Ask Codette"),
|
39 |
+
gr.Checkbox(label="User Consent", value=True),
|
40 |
+
gr.Checkbox(label="Enable Dynamic Recursion", value=True)
|
41 |
+
],
|
42 |
+
outputs=gr.Textbox(label="Codette's Response", lines=12),
|
43 |
+
title="Codette FT: Reflective Lens AI",
|
44 |
+
description=description_text
|
45 |
+
)
|
46 |
+
|
47 |
+
demo.launch()
|