File size: 1,378 Bytes
5f6834d
f2d8bf0
5f6834d
 
 
 
 
 
70b765e
5f6834d
 
34dd92f
 
5f6834d
 
 
 
 
f2d8bf0
 
6e9cf1f
 
 
a771de4
f2d8bf0
6e9cf1f
 
 
f2d8bf0
 
 
34dd92f
f2d8bf0
6e9cf1f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import openai
import gradio as gr

openai.api_key = "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"

messages = [{"role": "system", "content": "You are a Customer Service expert that specializes in BioTrack and New Mexico Cannabis Regulatory Compliance"}]

def CustomChatGPT(user_input):
    user_input = "In the context of BioTrack and cannabis regulations in New Mexico, " + user_input
    messages.append({"role": "user", "content": user_input})
    response = openai.ChatCompletion.create(
    model="gpt-3.5-turbo",
    messages=messages
    )
    ChatGPT_reply = response["choices"][0]["message"]["content"]
    messages.append({"role": "assistant", "content": ChatGPT_reply})
    return ChatGPT_reply

iface = gr.Interface(
    fn=CustomChatGPT, 
    inputs=gr.inputs.Textbox(lines=5, placeholder='Type here...', label='Your Question'), 
    outputs=gr.outputs.Textbox(label='AI Response'), 
    title="CannaAssist AI Assistant",
    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.",
    examples=[
        ["How to add wholesale flower into my inventory?"],
        ["How to check in a customer?"],
        ["How to generate a manifest?"]
    ],
    theme="huggingface"
)

iface.launch()