import openai import gradio as gr import os openai.api_key = os.getenv("OPENAI_API_KEY") def CustomChatGPT(category, user_input): 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"}] 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 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"] return ChatGPT_reply 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. DISCLAIMER: This is a proof of concept and not an official product.", examples=[ ["BioTrack", "How to add wholesale flower into my inventory?"], ["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?"], ["BioTrack", "How to set up a new user in BioTrack?"], ["BioTrack", "What steps are necessary for end of day closing in BioTrack?"], ["Regulations", "How much cannabis can I buy in New Mexico?"], ["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?"], ["Regulations", "What are the advertising restrictions for cannabis in New Mexico?"], ["Regulations", "What are the cannabis testing requirements in New Mexico?"], ["Best Practices", "What are the best practices for managing inventory?"], ["Best Practices", "How can I improve my dispensary's customer service?"], ["Best Practices", "What are some effective marketing strategies for a cannabis dispensary?"], ["Best Practices", "What are best practices for product pricing in the cannabis industry?"], ["Best Practices", "How can I improve the efficiency of my cannabis operation?"], ["Best Practices", "What are best practices for staff training in a cannabis dispensary?"], ["General Question", "How to increase sales for my dispensary?"], ["General Question", "How can I attract more customers to 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?"], ["General Question", "How can I differentiate my dispensary from competitors?"], ["General Question", "What are some successful promotional activities for cannabis dispensaries?"], ["General Question", "What is the impact of customer loyalty programs in the cannabis industry?"] ], theme=gr.themes.Monochrome() ) iface.launch()