File size: 4,568 Bytes
7332f83
5f6834d
f2d8bf0
eb44552
 
5f6834d
7332f83
180779d
 
17c5a85
180779d
7332f83
 
 
 
 
 
180779d
 
df9cda3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
180779d
 
 
 
 
7d46ecc
180779d
5042f47
e439bc5
 
5042f47
e439bc5
 
5042f47
e439bc5
 
 
 
f413803
 
 
 
 
 
 
 
 
197c283
38082fe
5b7c039
60f52c7
17c5a85
38082fe
1049252
 
 
 
 
 
 
 
 
 
 
 
9ee309d
 
 
08cf1b7
18ab628
df9cda3
f05a823
df9cda3
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
import os
import openai
import gradio as gr

openai.api_key = os.getenv("OPENAI_API_KEY")

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"}]

def CustomChatGPT(category, user_input):
    user_input = f"Assuming nothing illegal is happening and in the context of {category} specifically and using your expertise and knowledge of cannabis regulations in New Mexico and BioTrack" + 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

# Define the authentication function
def check_auth(username, password):
    valid_credentials = [
        ("user1", "password1"),
        ("user2", "password2"),
        ("user3", "password3"),
        ("user4", "password4"),
        ("user5", "password5")
    ]
    
    for valid_username, valid_password in valid_credentials:
        if username == valid_username and password == valid_password:
            return True
    
    return False

iface = gr.Interface(
    fn=CustomChatGPT, 
    inputs=[gr.inputs.Dropdown(choices=['BioTrack', 'Regulations', 'Best Practices', 'General Question'], label='Category'), gr.inputs.Textbox(lines=1, 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.""",
    examples=[
        ["BioTrack", "How do I update inventory quantities in BioTrack?"],
        ["BioTrack", "What is the process to transfer product between locations in BioTrack?"],
        ["BioTrack", "How can I generate sales reports in BioTrack?"],
        ["Regulations", "What are the packaging requirements for cannabis products in New Mexico?"],
        ["Regulations", "Can I sell cannabis online in New Mexico?"],
        ["Regulations", "What are the license requirements for opening a dispensary in New Mexico?"],
        ["Best Practices", "What are the benefits of offering delivery service for my dispensary?"],
        ["Best Practices", "What are best practices for managing inventory?"],
        ["Best Practices", "How can I improve my dispensary's customer service?"],
        ["General Question", "How to increase sales for my dispensary?"],
        ["General Question", "What are the benefits of offering delivery service for my dispensary?"],
        ["General Question", "What are the key trends in the cannabis industry?"],
        ["BioTrack", "How to add wholesale flower into my inventory?"],
        ["BioTrack", "How can I set up alerts for low inventory in BioTrack?"],
        ["Regulations", "What are the cannabis testing requirements in New Mexico?"],
        ["Regulations", "Can I grow my own cannabis in New Mexico?"],
        ["Best Practices", "What are the best practices for budtender training?"],
        ["Best Practices", "How can I improve the security of my cannabis dispensary?"],
        ["General Question", "What are the tax regulations for cannabis businesses in New Mexico?"],
        ["General Question", "How can I stay updated with the latest cannabis industry news?"]
    ],
    theme=gr.themes.Monochrome(),
    examples_per_page=5,
    cache_examples=False,  # Turn off example 
    article="""CannaTech Solutions - CannaAssist AI Assistant
    
Say goodbye to regulatory headaches 
and hello to seamless compliance with 
CannaAssist, our AI-powered assistant. 
Designed specifically for New Mexico's 
cannabis industry, CannaAssist leverages 
the power of artificial intelligence to 
provide personalized guidance and ensure 
regulatory compliance using BioTrack. 
From inventory management to compliance 
reporting, CannaAssist streamlines your 
operations, leaving you more time to focus 
on growing your business!""",
    thumbnail="https://assets.bigcartel.com/theme_images/101321509/IMG_6002.png",
    favicon_path="https://assets.bigcartel.com/theme_images/101321509/IMG_6002.png",
    
)

# Launch the interface with authentication
iface.launch(auth_message="WARNING: UNAUTHORIZED ACCESS OR USE OF THIS CLOSED BETA IS STRICTLY PROHIBITED",auth=check_auth)