Spaces:
Sleeping
Sleeping
arslan-ahmed
commited on
Commit
•
ce6fe1b
1
Parent(s):
c699df8
gradio auth
Browse files- app.py +1 -1
- ttyd_functions.py +1 -1
app.py
CHANGED
@@ -298,6 +298,6 @@ with gr.Blocks(theme=gr.themes.Default(primary_hue='orange', secondary_hue='gray
|
|
298 |
btn.click(**chat_btn_args)
|
299 |
msg.submit(**chat_btn_args)
|
300 |
|
|
|
301 |
demo.queue(default_concurrency_limit=10)
|
302 |
-
# gradio_auth=None # comment this if you want to use Authentication
|
303 |
demo.launch(show_error=True, auth=gradio_auth)
|
|
|
298 |
btn.click(**chat_btn_args)
|
299 |
msg.submit(**chat_btn_args)
|
300 |
|
301 |
+
gradio_auth = gradio_auth if os.getenv("GRADIO_USER",'') and os.getenv("GRADIO_PASS",'') else None
|
302 |
demo.queue(default_concurrency_limit=10)
|
|
|
303 |
demo.launch(show_error=True, auth=gradio_auth)
|
ttyd_functions.py
CHANGED
@@ -376,7 +376,7 @@ def getModelChoices(openAi_models, wml_models, bam_models):
|
|
376 |
return [model +' (openai)' for model in openAi_models] + [model.value +' (watsonx)' for model in wml_models] + [model + ' (bam)' for model in bam_models]
|
377 |
|
378 |
def gradio_auth(userInput, passInput):
|
379 |
-
if userInput == os.getenv("
|
380 |
return True
|
381 |
else:
|
382 |
return False
|
|
|
376 |
return [model +' (openai)' for model in openAi_models] + [model.value +' (watsonx)' for model in wml_models] + [model + ' (bam)' for model in bam_models]
|
377 |
|
378 |
def gradio_auth(userInput, passInput):
|
379 |
+
if userInput == os.getenv("GRADIO_USER",'') and passInput == os.getenv("GRADIO_PASS",''):
|
380 |
return True
|
381 |
else:
|
382 |
return False
|