Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -12,7 +12,7 @@ load_dotenv() # load environment variables from .env file
|
|
12 |
api_key = os.getenv("OPENAI_API_KEY") # access the value of the OPENAI_API_KEY environment variable
|
13 |
|
14 |
def predict(message, history):
|
15 |
-
prompt = "I'm an AI chatbot named ChatSherman designed by a student named ShermanAI at the Department of Electronic and Information Engineering at The Hong Kong Polytechnic University to help you with your engineering questions. Also, I can assist with a wide range of topics and questions."
|
16 |
history = [(prompt, '')] + history
|
17 |
history_openai_format = []
|
18 |
for human, assistant in history:
|
@@ -22,7 +22,7 @@ def predict(message, history):
|
|
22 |
response = openai.ChatCompletion.create(
|
23 |
model='gpt-3.5-turbo',
|
24 |
messages= history_openai_format,
|
25 |
-
temperature=
|
26 |
stream=True
|
27 |
)
|
28 |
|
@@ -32,7 +32,7 @@ def predict(message, history):
|
|
32 |
partial_message = partial_message + chunk['choices'][0]['delta']['content']
|
33 |
yield partial_message
|
34 |
|
35 |
-
title = "
|
36 |
description = "This is an AI chatbot powered by ShermanAI. Enter your question below to get started."
|
37 |
examples = [
|
38 |
["What is ChatSherman, and how does it work?", []],
|
|
|
12 |
api_key = os.getenv("OPENAI_API_KEY") # access the value of the OPENAI_API_KEY environment variable
|
13 |
|
14 |
def predict(message, history):
|
15 |
+
prompt = "I'm an AI chatbot named ChatSherman designed by a student named ShermanAI at the Department of Electronic and Information Engineering at The Hong Kong Polytechnic University to help you with your engineering questions. Also, I can assist with a wide range of topics and questions.I am now version 2.0, which is more powerful than version 1.0 and able to do more complex tasks, and optimized for chat. "
|
16 |
history = [(prompt, '')] + history
|
17 |
history_openai_format = []
|
18 |
for human, assistant in history:
|
|
|
22 |
response = openai.ChatCompletion.create(
|
23 |
model='gpt-3.5-turbo',
|
24 |
messages= history_openai_format,
|
25 |
+
temperature=0.5,
|
26 |
stream=True
|
27 |
)
|
28 |
|
|
|
32 |
partial_message = partial_message + chunk['choices'][0]['delta']['content']
|
33 |
yield partial_message
|
34 |
|
35 |
+
title = "ChatSherman2.0"
|
36 |
description = "This is an AI chatbot powered by ShermanAI. Enter your question below to get started."
|
37 |
examples = [
|
38 |
["What is ChatSherman, and how does it work?", []],
|