Spaces:
Build error
Build error
import whisper | |
import argparse | |
import os | |
def str2bool(string): | |
str2val = {"True": True, "False": False} | |
if string in str2val: | |
return str2val[string] | |
else: | |
raise ValueError( | |
f"Expected one of {set(str2val.keys())}, got {string}") | |
def get_args(): | |
parser = argparse.ArgumentParser( | |
formatter_class=argparse.ArgumentDefaultsHelpFormatter) | |
parser.add_argument("--public", type=str2bool, default=False, | |
help="Wether to share with gradio public or not") | |
parser.add_argument("--preload", type=str2bool, default=True, | |
help="Should the model be preloaded on script launch. Disable for faster debug") | |
parser.add_argument("--model", default=os.environ.get('MODEL_SIZE', "medium"), | |
choices=whisper.available_models(), help="name of the Whisper model to use") | |
args = parser.parse_args().__dict__ | |
return args | |