bentobytes commited on
Commit
403dd0c
·
1 Parent(s): e212c84

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -1
app.py CHANGED
@@ -42,6 +42,17 @@ with gr.Blocks() as demo:
42
  # username: ('LawGPT0','')
43
  # password: ('GPT089!')
44
  # return username == password
 
 
 
45
 
 
 
 
 
 
 
 
 
46
  #if __name__ == '__main__':
47
- demo.launch(auth=[("admin", "pass1234"),("razzan", "rosli")])
 
42
  # username: ('LawGPT0','')
43
  # password: ('GPT089!')
44
  # return username == password
45
+
46
+ # Retrieve the serialized list of username and password pairs from environment variable
47
+ credentials_json = os.environ.get("CREDENTIALS")
48
 
49
+ if credentials_json is None:
50
+ print("Error: Please set the CREDENTIALS environment variable with a JSON representation of the username and password pairs.")
51
+ else:
52
+ # Parse the JSON string into a list of tuples
53
+ credentials = json.loads(credentials_json)
54
+ demo.launch(auth=credentials)
55
+
56
+
57
  #if __name__ == '__main__':
58
+ #demo.launch(auth=[("admin", "pa"),("razzan", "rosli")])