Spaces:
Runtime error
Runtime error
File size: 3,534 Bytes
5f6834d f2d8bf0 5f6834d 180779d ed3eff1 6c45c8d ed3eff1 d7652fa c7fe865 5f6834d 34dd92f 5f6834d ed3eff1 f2d8bf0 e13f8b9 6e9cf1f a771de4 e13f8b9 f2d8bf0 6e9cf1f ed3eff1 d7652fa |
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 |
import openai
import gradio as gr
openai.api_key = "import openai
import gradio as gr
openai.api_key = "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"
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 = "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
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?"],
["Regulations", "How much cannabis can I buy in New Mexico."],
["Best Practices", "What are the best practices for managing inventory?"],
["General Question", "How to increase sales for my dispensary?"]
],
theme="huggingface"
)
iface.launch()
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 = "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
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?"],
["Regulations", "How much cannabis can I buy in New Mexico."],
["Best Practices", "What are the best practices for managing inventory?"],
["General Question", "How to increase sales for my dispensary?"]
],
theme="huggingface"
)
iface.launch()
|