Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,40 @@
|
|
1 |
import openai
|
2 |
import gradio as gr
|
3 |
|
4 |
-
openai.api_key = "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
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"}]
|
7 |
|
|
|
1 |
import openai
|
2 |
import gradio as gr
|
3 |
|
4 |
+
openai.api_key = "import openai
|
5 |
+
import gradio as gr
|
6 |
+
|
7 |
+
openai.api_key = "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"
|
8 |
+
|
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 |
+
|
11 |
+
def CustomChatGPT(category, user_input):
|
12 |
+
user_input = "In the context of {category} specifically and using your expertise and knowledge of cannabis regulations in New Mexico and BioTrack" + user_input
|
13 |
+
messages.append({"role": "user", "content": user_input})
|
14 |
+
response = openai.ChatCompletion.create(
|
15 |
+
model="gpt-3.5-turbo",
|
16 |
+
messages=messages
|
17 |
+
)
|
18 |
+
ChatGPT_reply = response["choices"][0]["message"]["content"]
|
19 |
+
messages.append({"role": "assistant", "content": ChatGPT_reply})
|
20 |
+
return ChatGPT_reply
|
21 |
+
|
22 |
+
iface = gr.Interface(
|
23 |
+
fn=CustomChatGPT,
|
24 |
+
inputs=[gr.inputs.Dropdown(choices=['BioTrack', 'Regulations', 'Best Practices', 'General Question'], label='Category'), gr.inputs.Textbox(lines=1, placeholder='Type here...', label='Your Question')],
|
25 |
+
outputs=gr.outputs.Textbox(label='AI Response'),
|
26 |
+
title="CannaAssist AI Assistant",
|
27 |
+
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.",
|
28 |
+
examples=[
|
29 |
+
["BioTrack", "How to add wholesale flower into my inventory?"],
|
30 |
+
["Regulations", "How much cannabis can I buy in New Mexico."],
|
31 |
+
["Best Practices", "What are the best practices for managing inventory?"],
|
32 |
+
["General Question", "How to increase sales for my dispensary?"]
|
33 |
+
],
|
34 |
+
theme="huggingface"
|
35 |
+
)
|
36 |
+
|
37 |
+
iface.launch()
|
38 |
|
39 |
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"}]
|
40 |
|