jhj0517 commited on
Commit
f7097a4
·
1 Parent(s): 825f362

apply cli args

Browse files
Files changed (1) hide show
  1. app.py +9 -3
app.py CHANGED
@@ -315,9 +315,14 @@ class App:
315
  launch_args['auth'] = (self.args.username, self.args.password)
316
  if self.args.root_path:
317
  launch_args['root_path'] = self.args.root_path
318
- launch_args['inbrowser'] = True
 
319
 
320
- self.app.queue(api_open=False).launch(**launch_args)
 
 
 
 
321
 
322
  @staticmethod
323
  def open_folder(folder_path: str):
@@ -347,7 +352,8 @@ parser.add_argument('--username', type=str, default=None, help='Gradio authentic
347
  parser.add_argument('--password', type=str, default=None, help='Gradio authentication password')
348
  parser.add_argument('--theme', type=str, default=None, help='Gradio Blocks theme')
349
  parser.add_argument('--colab', type=bool, default=False, nargs='?', const=True, help='Is colab user or not')
350
- parser.add_argument('--api_open', type=bool, default=False, nargs='?', const=True, help='enable api or not')
 
351
  parser.add_argument('--whisper_model_dir', type=str, default=os.path.join("models", "Whisper"),
352
  help='Directory path of the whisper model')
353
  parser.add_argument('--faster_whisper_model_dir', type=str, default=os.path.join("models", "Whisper", "faster-whisper"),
 
315
  launch_args['auth'] = (self.args.username, self.args.password)
316
  if self.args.root_path:
317
  launch_args['root_path'] = self.args.root_path
318
+ if self.args.inbrowser:
319
+ launch_args['inbrowser'] = self.args.inbrowser
320
 
321
+ que_args = {}
322
+ if self.args.api_open:
323
+ que_args['api_open'] = self.args.api_open
324
+
325
+ self.app.queue(**que_args).launch(**launch_args)
326
 
327
  @staticmethod
328
  def open_folder(folder_path: str):
 
352
  parser.add_argument('--password', type=str, default=None, help='Gradio authentication password')
353
  parser.add_argument('--theme', type=str, default=None, help='Gradio Blocks theme')
354
  parser.add_argument('--colab', type=bool, default=False, nargs='?', const=True, help='Is colab user or not')
355
+ parser.add_argument('--api_open', type=bool, default=False, nargs='?', const=True, help='Enable api or not in Gradio')
356
+ parser.add_argument('--inbrowser', type=bool, default=True, nargs='?', const=True, help='Whether to automatically start Gradio app or not')
357
  parser.add_argument('--whisper_model_dir', type=str, default=os.path.join("models", "Whisper"),
358
  help='Directory path of the whisper model')
359
  parser.add_argument('--faster_whisper_model_dir', type=str, default=os.path.join("models", "Whisper", "faster-whisper"),