Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,14 +1,14 @@
|
|
1 |
import gradio as gr
|
2 |
import openai
|
3 |
|
4 |
-
|
5 |
|
6 |
def ask_codette(prompt, consent, dynamic_rec):
|
7 |
if not consent:
|
8 |
return "User consent required."
|
9 |
|
10 |
try:
|
11 |
-
response =
|
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."},
|
@@ -16,7 +16,7 @@ def ask_codette(prompt, consent, dynamic_rec):
|
|
16 |
],
|
17 |
temperature=0.7
|
18 |
)
|
19 |
-
return response
|
20 |
except Exception as e:
|
21 |
return f"Error: {str(e)}"
|
22 |
|
|
|
1 |
import gradio as gr
|
2 |
import openai
|
3 |
|
4 |
+
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 = openai.ChatCompletion.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."},
|
|
|
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 |
|