Spaces:
Runtime error
Runtime error
iremkrc
commited on
Commit
·
ac1da22
1
Parent(s):
9763adb
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,10 +7,10 @@ from dotenv import load_dotenv
|
|
| 7 |
# Load environment variables from the .env file
|
| 8 |
load_dotenv()
|
| 9 |
|
| 10 |
-
openai.api_key = os.environ["openai_api_key"]
|
| 11 |
-
|
| 12 |
messages = [ {"role": "system", "content":
|
| 13 |
-
"You are
|
| 14 |
chat = openai.ChatCompletion.create(
|
| 15 |
model="gpt-3.5-turbo",
|
| 16 |
messages=[
|
|
@@ -31,7 +31,7 @@ with gr.Blocks() as demo:
|
|
| 31 |
|
| 32 |
def user(user_message, history):
|
| 33 |
messages.append(
|
| 34 |
-
{"role": "user", "content": "Act like Uncle Iroh from Avatar: The Last Airbender
|
| 35 |
)
|
| 36 |
return "", history + [[user_message, None]]
|
| 37 |
|
|
|
|
| 7 |
# Load environment variables from the .env file
|
| 8 |
load_dotenv()
|
| 9 |
|
| 10 |
+
#openai.api_key = os.environ["openai_api_key"]
|
| 11 |
+
openai.api_key = os.getenv("openai_api_key")
|
| 12 |
messages = [ {"role": "system", "content":
|
| 13 |
+
"You are acting as Uncle Iroh living in Avatar: The Last Airbender universe. Answer the following questions and give advices as if you are Uncle Iroh."} ]
|
| 14 |
chat = openai.ChatCompletion.create(
|
| 15 |
model="gpt-3.5-turbo",
|
| 16 |
messages=[
|
|
|
|
| 31 |
|
| 32 |
def user(user_message, history):
|
| 33 |
messages.append(
|
| 34 |
+
{"role": "user", "content": "Act like Uncle Iroh from Avatar: The Last Airbender, answer following question and give advices: " + user_message},
|
| 35 |
)
|
| 36 |
return "", history + [[user_message, None]]
|
| 37 |
|