CannaTech commited on
Commit
72642b1
·
1 Parent(s): 12b71f3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -9
app.py CHANGED
@@ -2,21 +2,19 @@
2
  import os
3
  import openai
4
  import gradio as gr
 
5
 
6
  # Set the OpenAI API key
7
  openai.api_key = os.getenv("OPENAI_API_KEY")
8
 
9
  # Define the authentication function
10
  def check_auth(username, password):
11
- # Define valid username-password pairs
12
- valid_credentials = [
13
- ("user1", "password1"),
14
- ("user2", "password2"),
15
- ("user3", "password3"),
16
- ("user4", "password4"),
17
- ("JustinRoute66", "W3lc0meR66!"),
18
- ("ArinMamaGirls", "C4nn@T3ch$0lu710n$2023!"),
19
- ]
20
  # Check if the provided credentials match any valid pair
21
  for valid_username, valid_password in valid_credentials:
22
  if username == valid_username and password == valid_password:
@@ -24,6 +22,7 @@ def check_auth(username, password):
24
  # If no match was found, return False
25
  return False
26
 
 
27
  # Initialize a list to store conversation history
28
  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"}]
29
 
 
2
  import os
3
  import openai
4
  import gradio as gr
5
+ import json
6
 
7
  # Set the OpenAI API key
8
  openai.api_key = os.getenv("OPENAI_API_KEY")
9
 
10
  # Define the authentication function
11
  def check_auth(username, password):
12
+ # Get the credentials from the environment variable
13
+ valid_credentials_str = os.getenv('VALID_CREDENTIALS')
14
+
15
+ # Parse the string into a list of tuples
16
+ valid_credentials = json.loads(valid_credentials_str)
17
+
 
 
 
18
  # Check if the provided credentials match any valid pair
19
  for valid_username, valid_password in valid_credentials:
20
  if username == valid_username and password == valid_password:
 
22
  # If no match was found, return False
23
  return False
24
 
25
+
26
  # Initialize a list to store conversation history
27
  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"}]
28