Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,17 @@
|
|
|
|
|
|
1 |
import openai
|
2 |
import gradio as gr
|
|
|
3 |
|
4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
|
@@ -16,19 +26,45 @@ def CustomChatGPT(category, user_input):
|
|
16 |
messages.append({"role": "assistant", "content": ChatGPT_reply})
|
17 |
return ChatGPT_reply
|
18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
iface = gr.Interface(
|
20 |
fn=CustomChatGPT,
|
21 |
-
inputs=[
|
|
|
|
|
|
|
22 |
outputs=gr.outputs.Textbox(label='AI Response'),
|
23 |
title="CannaAssist AI Assistant",
|
24 |
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.",
|
25 |
-
examples=
|
26 |
-
|
27 |
-
["Regulations", "How much cannabis can I buy in New Mexico."],
|
28 |
-
["Best Practices", "What are the best practices for managing inventory?"],
|
29 |
-
["General Question", "How to increase sales for my dispensary?"]
|
30 |
-
],
|
31 |
-
theme="huggingface"
|
32 |
)
|
33 |
|
34 |
iface.launch()
|
|
|
1 |
+
import os
|
2 |
+
from getpass import getpass
|
3 |
import openai
|
4 |
import gradio as gr
|
5 |
+
from huggingface_hub import HfApi
|
6 |
|
7 |
+
# Get API key from Hugging Face secret repository
|
8 |
+
# Make sure to replace 'CannaTech' and 'OPENAI_API_KEY' with your Hugging Face username and the name of your secret repository
|
9 |
+
# You will be prompted to enter your Hugging Face password
|
10 |
+
api = HfApi()
|
11 |
+
password = getpass("Enter your Hugging Face password: ")
|
12 |
+
token = api.login(username="CannaTech", password=password)
|
13 |
+
api.create_repo(token=token, name="OPENAI_API_KEY", exist_ok=True)
|
14 |
+
openai.api_key = api.get_secret(token=token, repo_id="CannaTech/OPENAI_API_KEY", secret_name="openai-api-key")
|
15 |
|
16 |
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"}]
|
17 |
|
|
|
26 |
messages.append({"role": "assistant", "content": ChatGPT_reply})
|
27 |
return ChatGPT_reply
|
28 |
|
29 |
+
examples = [
|
30 |
+
["BioTrack", "What is the process to register for BioTrack in New Mexico?"],
|
31 |
+
["BioTrack", "How to add a new product in BioTrack?"],
|
32 |
+
["BioTrack", "What are the steps to update inventory in BioTrack?"],
|
33 |
+
["BioTrack", "How to generate sales reports in BioTrack?"],
|
34 |
+
["BioTrack", "Can I integrate BioTrack with my existing POS system?"],
|
35 |
+
["BioTrack", "What are the data backup options in BioTrack?"],
|
36 |
+
["BioTrack", "How to handle product returns in BioTrack?"],
|
37 |
+
["BioTrack", "What are the security features of BioTrack?"],
|
38 |
+
["BioTrack", "How to train my staff to use BioTrack?"],
|
39 |
+
["BioTrack", "What are the system requirements to run BioTrack?"],
|
40 |
+
["Regulations", "What is the legal age to purchase cannabis in New Mexico?"],
|
41 |
+
["Regulations", "What are the packaging and labeling requirements for cannabis in New Mexico?"],
|
42 |
+
["Regulations", "What are the limits on cannabis possession in New Mexico?"],
|
43 |
+
["Regulations", "Can I grow my own cannabis in New Mexico?"],
|
44 |
+
["Regulations", "What are the regulations for cannabis edibles in New Mexico?"],
|
45 |
+
["Regulations", "What are the licensing requirements for opening a dispensary in New Mexico?"],
|
46 |
+
["Regulations", "What are the regulations for cannabis advertising in New Mexico?"],
|
47 |
+
["Regulations", "What are the penalties for non-compliance with cannabis regulations in New Mexico?"],
|
48 |
+
["Regulations", "Can I use medical cannabis in public in New Mexico?"],
|
49 |
+
["Regulations", "What are the regulations for transporting cannabis in New Mexico?"],
|
50 |
+
["BioTrack", "How to report a lost or stolen product in BioTrack?"],
|
51 |
+
["Regulations", "What are the regulations for cannabis waste disposal in New Mexico?"],
|
52 |
+
["BioTrack", "How to handle customer complaints in BioTrack?"],
|
53 |
+
["Regulations", "What are the regulations for cannabis testing in New Mexico?"],
|
54 |
+
["BioTrack", "How to manage multiple locations in BioTrack?"]
|
55 |
+
]
|
56 |
+
|
57 |
iface = gr.Interface(
|
58 |
fn=CustomChatGPT,
|
59 |
+
inputs=[
|
60 |
+
gr.inputs.Dropdown(choices=['BioTrack', 'Regulations', 'Best Practices', 'General Question'], label='Category', type='value'),
|
61 |
+
gr.inputs.Textbox(lines=1, placeholder='Type here...', label='Your Question')
|
62 |
+
],
|
63 |
outputs=gr.outputs.Textbox(label='AI Response'),
|
64 |
title="CannaAssist AI Assistant",
|
65 |
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.",
|
66 |
+
examples=examples,
|
67 |
+
theme="upscale"
|
|
|
|
|
|
|
|
|
|
|
68 |
)
|
69 |
|
70 |
iface.launch()
|