Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -5,17 +5,15 @@ import os
|
|
5 |
openai.api_key = os.getenv("OPENAI_API_KEY")
|
6 |
|
7 |
|
8 |
-
messages = [{"role": "system", "content": "You are an expert in Technical Support and Customer Service that specializes in New Mexico Cannabis Regulatory Compliance and training people how to use software called BioTrack"}]
|
9 |
-
|
10 |
def CustomChatGPT(category, user_input):
|
11 |
-
|
|
|
12 |
messages.append({"role": "user", "content": user_input})
|
13 |
response = openai.ChatCompletion.create(
|
14 |
model="gpt-3.5-turbo",
|
15 |
messages=messages
|
16 |
)
|
17 |
-
ChatGPT_reply = response
|
18 |
-
messages.append({"role": "assistant", "content": ChatGPT_reply})
|
19 |
return ChatGPT_reply
|
20 |
|
21 |
iface = gr.Interface(
|
@@ -55,8 +53,3 @@ iface = gr.Interface(
|
|
55 |
)
|
56 |
|
57 |
iface.launch()
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
|
|
5 |
openai.api_key = os.getenv("OPENAI_API_KEY")
|
6 |
|
7 |
|
|
|
|
|
8 |
def CustomChatGPT(category, user_input):
|
9 |
+
messages = [{"role": "system", "content": "You are an expert in Technical Support and Customer Service that specializes in New Mexico Cannabis Regulatory Compliance and training people how to use software called BioTrack"}]
|
10 |
+
user_input = f"In the context of {category} specifically and using your expertise and knowledge of cannabis regulations in New Mexico and BioTrack, " + user_input
|
11 |
messages.append({"role": "user", "content": user_input})
|
12 |
response = openai.ChatCompletion.create(
|
13 |
model="gpt-3.5-turbo",
|
14 |
messages=messages
|
15 |
)
|
16 |
+
ChatGPT_reply = response.choices[0].message["content"]
|
|
|
17 |
return ChatGPT_reply
|
18 |
|
19 |
iface = gr.Interface(
|
|
|
53 |
)
|
54 |
|
55 |
iface.launch()
|
|
|
|
|
|
|
|
|
|