Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -27,39 +27,12 @@ iface = gr.Interface(
|
|
27 |
["Regulations", "How much cannabis can I buy in New Mexico."],
|
28 |
["Best Practices", "What are the best practices for managing inventory?"],
|
29 |
["General Question", "How to increase sales for my dispensary?"]
|
30 |
-
]
|
31 |
-
|
32 |
)
|
33 |
|
34 |
iface.launch()
|
35 |
|
36 |
-
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"}]
|
37 |
|
38 |
-
def CustomChatGPT(category, user_input):
|
39 |
-
user_input = "In the context of {category} specifically and using your expertise and knowledge of cannabis regulations in New Mexico and BioTrack" + user_input
|
40 |
-
messages.append({"role": "user", "content": user_input})
|
41 |
-
response = openai.ChatCompletion.create(
|
42 |
-
model="gpt-3.5-turbo",
|
43 |
-
messages=messages
|
44 |
-
)
|
45 |
-
ChatGPT_reply = response["choices"][0]["message"]["content"]
|
46 |
-
messages.append({"role": "assistant", "content": ChatGPT_reply})
|
47 |
-
return ChatGPT_reply
|
48 |
|
49 |
-
iface = gr.Interface(
|
50 |
-
fn=CustomChatGPT,
|
51 |
-
inputs=[gr.inputs.Dropdown(choices=['BioTrack', 'Regulations', 'Best Practices', 'General Question'], label='Category'), gr.inputs.Textbox(lines=1, placeholder='Type here...', label='Your Question')],
|
52 |
-
outputs=gr.outputs.Textbox(label='AI Response'),
|
53 |
-
title="CannaAssist AI Assistant",
|
54 |
-
description="Welcome to the CannaAssist AI Assistant. This tool is designed to provide expert guidance on BioTrack and cannabis regulations in New Mexico. DISCLAIMER: This is a proof of concept and not an official product.",
|
55 |
-
examples=[
|
56 |
-
["BioTrack", "How to add wholesale flower into my inventory?"],
|
57 |
-
["Regulations", "How much cannabis can I buy in New Mexico."],
|
58 |
-
["Best Practices", "What are the best practices for managing inventory?"],
|
59 |
-
["General Question", "How to increase sales for my dispensary?"]
|
60 |
-
],
|
61 |
-
|
62 |
-
)
|
63 |
-
|
64 |
-
iface.launch()
|
65 |
|
|
|
27 |
["Regulations", "How much cannabis can I buy in New Mexico."],
|
28 |
["Best Practices", "What are the best practices for managing inventory?"],
|
29 |
["General Question", "How to increase sales for my dispensary?"]
|
30 |
+
]
|
31 |
+
|
32 |
)
|
33 |
|
34 |
iface.launch()
|
35 |
|
|
|
36 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
|