CannaTech commited on
Commit
e13f8b9
·
1 Parent(s): 0724543

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -50
app.py CHANGED
@@ -1,20 +1,8 @@
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
-
18
  def CustomChatGPT(category, user_input):
19
  user_input = "In the context of {category} specifically and using your expertise and knowledge of cannabis regulations in New Mexico and BioTrack" + user_input
20
  messages.append({"role": "user", "content": user_input})
@@ -25,49 +13,20 @@ def CustomChatGPT(category, user_input):
25
  ChatGPT_reply = response["choices"][0]["message"]["content"]
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()
71
 
72
 
73
-
 
 
 
1
  import openai
2
  import gradio as gr
 
 
 
 
 
 
 
 
 
 
3
 
4
+ openai.api_key = "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
5
  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"}]
 
6
  def CustomChatGPT(category, user_input):
7
  user_input = "In the context of {category} specifically and using your expertise and knowledge of cannabis regulations in New Mexico and BioTrack" + user_input
8
  messages.append({"role": "user", "content": user_input})
 
13
  ChatGPT_reply = response["choices"][0]["message"]["content"]
14
  messages.append({"role": "assistant", "content": ChatGPT_reply})
15
  return ChatGPT_reply
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  iface = gr.Interface(
17
  fn=CustomChatGPT,
18
+ inputs=[gr.inputs.Dropdown(choices=['BioTrack', 'Regulations', 'Best Practices', 'General Question'], label='Category'), gr.inputs.Textbox(lines=1, placeholder='Type here...', label='Your Question')],
 
 
 
19
  outputs=gr.outputs.Textbox(label='AI Response'),
20
  title="CannaAssist AI Assistant",
21
  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.",
22
+ examples=[
23
+ ["BioTrack", "How to add wholesale flower into my inventory?"],
24
+ ["Regulations", "How much cannabis can I buy in New Mexico."],
25
+ ["Best Practices", "What are the best practices for managing inventory?"],
26
+ ["General Question", "How to increase sales for my dispensary?"]
27
+ ],
28
+ theme="huggingface"
29
  )
 
30
  iface.launch()
31
 
32