jhj0517 commited on
Commit
e30abef
·
2 Parent(s): a8c9eff ea9212d

Merge branch 'master' into feature/add-bgm-tab

Browse files
Files changed (2) hide show
  1. app.py +5 -4
  2. modules/utils/cli_manager.py +12 -0
app.py CHANGED
@@ -12,6 +12,7 @@ from modules.whisper.faster_whisper_inference import FasterWhisperInference
12
  from modules.whisper.insanely_fast_whisper_inference import InsanelyFastWhisperInference
13
  from modules.translation.nllb_inference import NLLBInference
14
  from modules.ui.htmls import *
 
15
  from modules.utils.youtube_manager import get_ytmetas
16
  from modules.translation.deepl_api import DeepLAPI
17
  from modules.whisper.whisper_parameter import *
@@ -412,16 +413,16 @@ class App:
412
  parser = argparse.ArgumentParser()
413
  parser.add_argument('--whisper_type', type=str, default="faster-whisper",
414
  help='A type of the whisper implementation between: ["whisper", "faster-whisper", "insanely-fast-whisper"]')
415
- parser.add_argument('--share', type=bool, default=False, nargs='?', const=True, help='Gradio share value')
416
  parser.add_argument('--server_name', type=str, default=None, help='Gradio server host')
417
  parser.add_argument('--server_port', type=int, default=None, help='Gradio server port')
418
  parser.add_argument('--root_path', type=str, default=None, help='Gradio root path')
419
  parser.add_argument('--username', type=str, default=None, help='Gradio authentication username')
420
  parser.add_argument('--password', type=str, default=None, help='Gradio authentication password')
421
  parser.add_argument('--theme', type=str, default=None, help='Gradio Blocks theme')
422
- parser.add_argument('--colab', type=bool, default=False, nargs='?', const=True, help='Is colab user or not')
423
- parser.add_argument('--api_open', type=bool, default=False, nargs='?', const=True, help='Enable api or not in Gradio')
424
- parser.add_argument('--inbrowser', type=bool, default=True, nargs='?', const=True, help='Whether to automatically start Gradio app or not')
425
  parser.add_argument('--whisper_model_dir', type=str, default=WHISPER_MODELS_DIR,
426
  help='Directory path of the whisper model')
427
  parser.add_argument('--faster_whisper_model_dir', type=str, default=FASTER_WHISPER_MODELS_DIR,
 
12
  from modules.whisper.insanely_fast_whisper_inference import InsanelyFastWhisperInference
13
  from modules.translation.nllb_inference import NLLBInference
14
  from modules.ui.htmls import *
15
+ from modules.utils.cli_manager import str2bool
16
  from modules.utils.youtube_manager import get_ytmetas
17
  from modules.translation.deepl_api import DeepLAPI
18
  from modules.whisper.whisper_parameter import *
 
413
  parser = argparse.ArgumentParser()
414
  parser.add_argument('--whisper_type', type=str, default="faster-whisper",
415
  help='A type of the whisper implementation between: ["whisper", "faster-whisper", "insanely-fast-whisper"]')
416
+ parser.add_argument('--share', type=str2bool, default=False, nargs='?', const=True, help='Gradio share value')
417
  parser.add_argument('--server_name', type=str, default=None, help='Gradio server host')
418
  parser.add_argument('--server_port', type=int, default=None, help='Gradio server port')
419
  parser.add_argument('--root_path', type=str, default=None, help='Gradio root path')
420
  parser.add_argument('--username', type=str, default=None, help='Gradio authentication username')
421
  parser.add_argument('--password', type=str, default=None, help='Gradio authentication password')
422
  parser.add_argument('--theme', type=str, default=None, help='Gradio Blocks theme')
423
+ parser.add_argument('--colab', type=str2bool, default=False, nargs='?', const=True, help='Is colab user or not')
424
+ parser.add_argument('--api_open', type=str2bool, default=False, nargs='?', const=True, help='Enable api or not in Gradio')
425
+ parser.add_argument('--inbrowser', type=str2bool, default=True, nargs='?', const=True, help='Whether to automatically start Gradio app or not')
426
  parser.add_argument('--whisper_model_dir', type=str, default=WHISPER_MODELS_DIR,
427
  help='Directory path of the whisper model')
428
  parser.add_argument('--faster_whisper_model_dir', type=str, default=FASTER_WHISPER_MODELS_DIR,
modules/utils/cli_manager.py ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import argparse
2
+
3
+
4
+ def str2bool(v):
5
+ if isinstance(v, bool):
6
+ return v
7
+ if v.lower() in ('yes', 'true', 't', 'y', '1'):
8
+ return True
9
+ elif v.lower() in ('no', 'false', 'f', 'n', '0'):
10
+ return False
11
+ else:
12
+ raise argparse.ArgumentTypeError('Boolean value expected.')