jhj0517 commited on
Commit
0184fe2
·
1 Parent(s): 54a7493

Fix gradio input visibility by implementation type

Browse files
Files changed (1) hide show
  1. modules/whisper/data_classes.py +6 -6
modules/whisper/data_classes.py CHANGED
@@ -297,12 +297,12 @@ class WhisperParams(BaseParams):
297
  def to_gradio_inputs(cls,
298
  defaults: Optional[Dict] = None,
299
  only_advanced: Optional[bool] = True,
300
- whisper_type: Optional[WhisperImpl] = None,
301
  available_models: Optional[List] = None,
302
  available_langs: Optional[List] = None,
303
  available_compute_types: Optional[List] = None,
304
  compute_type: Optional[str] = None):
305
- whisper_type = WhisperImpl.FASTER_WHISPER if whisper_type is None else whisper_type
306
 
307
  inputs = []
308
  if not only_advanced:
@@ -491,13 +491,13 @@ class WhisperParams(BaseParams):
491
  )
492
  ]
493
 
494
- if whisper_type == WhisperImpl.FASTER_WHISPER:
495
  for input_component in faster_whisper_inputs:
496
- input_component.visible = True
497
 
498
- if whisper_type == WhisperImpl.INSANELY_FAST_WHISPER:
499
  for input_component in insanely_fast_whisper_inputs:
500
- input_component.visible = True
501
 
502
  inputs += faster_whisper_inputs + insanely_fast_whisper_inputs
503
 
 
297
  def to_gradio_inputs(cls,
298
  defaults: Optional[Dict] = None,
299
  only_advanced: Optional[bool] = True,
300
+ whisper_type: Optional[str] = None,
301
  available_models: Optional[List] = None,
302
  available_langs: Optional[List] = None,
303
  available_compute_types: Optional[List] = None,
304
  compute_type: Optional[str] = None):
305
+ whisper_type = WhisperImpl.FASTER_WHISPER.value if whisper_type is None else whisper_type.strip().lower()
306
 
307
  inputs = []
308
  if not only_advanced:
 
491
  )
492
  ]
493
 
494
+ if whisper_type != WhisperImpl.FASTER_WHISPER.value:
495
  for input_component in faster_whisper_inputs:
496
+ input_component.visible = False
497
 
498
+ if whisper_type != WhisperImpl.INSANELY_FAST_WHISPER.value:
499
  for input_component in insanely_fast_whisper_inputs:
500
+ input_component.visible = False
501
 
502
  inputs += faster_whisper_inputs + insanely_fast_whisper_inputs
503