pjpjq commited on
Commit
f01821e
·
1 Parent(s): 9c0e397

Fix: pass launch params and add auth support via env vars

Browse files

- Pass server_name, server_port, share to launch()
- Add GRADIO_AUTH_USER/GRADIO_AUTH_PASS env var support for password protection

Files changed (1) hide show
  1. gui/web_ui.py +13 -1
gui/web_ui.py CHANGED
@@ -205,7 +205,19 @@ class WebUI:
205
 
206
  demo.load(None)
207
 
208
- demo.queue(default_concurrency_limit=concurrency_limit).launch()
 
 
 
 
 
 
 
 
 
 
 
 
209
 
210
  def change_agent(self, agent_selector):
211
  yield agent_selector, self._create_agent_info_block(agent_selector), self._create_agent_plugins_block(
 
205
 
206
  demo.load(None)
207
 
208
+ # Get auth from environment variable
209
+ auth = None
210
+ auth_user = os.environ.get('GRADIO_AUTH_USER')
211
+ auth_pass = os.environ.get('GRADIO_AUTH_PASS')
212
+ if auth_user and auth_pass:
213
+ auth = (auth_user, auth_pass)
214
+
215
+ demo.queue(default_concurrency_limit=concurrency_limit).launch(
216
+ server_name=server_name,
217
+ server_port=server_port,
218
+ share=share,
219
+ auth=auth,
220
+ )
221
 
222
  def change_agent(self, agent_selector):
223
  yield agent_selector, self._create_agent_info_block(agent_selector), self._create_agent_plugins_block(