Support of the --gradio-auth flag (#2283)
This commit is contained in:
parent
4155aaa96a
commit
7aed53559a
3 changed files with 6 additions and 1 deletions
|
@ -543,11 +543,14 @@ def create_interface():
|
|||
|
||||
# Authentication variables
|
||||
auth = None
|
||||
gradio_auth_creds = []
|
||||
if shared.args.gradio_auth:
|
||||
gradio_auth_creds += [x.strip() for x in shared.args.gradio_auth.strip('"').replace('\n', '').split(',') if x.strip()]
|
||||
if shared.args.gradio_auth_path is not None:
|
||||
gradio_auth_creds = []
|
||||
with open(shared.args.gradio_auth_path, 'r', encoding="utf8") as file:
|
||||
for line in file.readlines():
|
||||
gradio_auth_creds += [x.strip() for x in line.split(',') if x.strip()]
|
||||
if gradio_auth_creds:
|
||||
auth = [tuple(cred.split(':')) for cred in gradio_auth_creds]
|
||||
|
||||
# Importing the extension files and executing their setup() functions
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue