Raiff1982 commited on
Commit
56147d9
·
verified ·
1 Parent(s): fb95799

Create app2.py

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