Spaces:
No application file
No application file
Delete app.py
Browse files
app.py
DELETED
@@ -1,33 +0,0 @@
|
|
1 |
-
|
2 |
-
from openai import openai
|
3 |
-
|
4 |
-
# Set your OpenAI API key
|
5 |
-
openai.api_key = "sk-proj-Le8x5S4tj5MqEYrfHTcTT3BlbkFJ1gEvzbajj6ohRo09b1uk"
|
6 |
-
|
7 |
-
# Define conversation data for fine-tuning
|
8 |
-
conversation_data = [
|
9 |
-
{"role": "system", "content": "Hello, how can I help you today?"},
|
10 |
-
{"role": "user", "content": "I'm feeling really anxious lately."},
|
11 |
-
{"role": "system", "content": "I'm here to listen. Would you like to talk about what's been causing your anxiety?"}
|
12 |
-
# Add more conversation data as needed
|
13 |
-
]
|
14 |
-
|
15 |
-
# Fine-tune GPT-3 using conversation data
|
16 |
-
openai.ChatCompletion.create(
|
17 |
-
model="gpt-3.5-turbo", # or another GPT-3 variant
|
18 |
-
messages=conversation_data,
|
19 |
-
fine_tune=True # Specify fine-tuning
|
20 |
-
)
|
21 |
-
|
22 |
-
# Once fine-tuned, use the model to generate responses to user inputs
|
23 |
-
response = openai.ChatCompletion.create(
|
24 |
-
model="gpt-3.5-turbo",
|
25 |
-
messages=[
|
26 |
-
{"role": "user", "content": "My life is chaotic right now."}
|
27 |
-
]
|
28 |
-
)
|
29 |
-
|
30 |
-
# Get the chatbot's response
|
31 |
-
reply = response["choices"][0]["message"]["content"]
|
32 |
-
|
33 |
-
print("Chatbot:", reply)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|