config.py 830 B

12345678910111213141516171819202122232425262728293031
  1. import os
  2. def check_fw_local_models():
  3. '''
  4. 启动时检查本地是否有 Faster Whisper 模型.
  5. '''
  6. model_size_list = [
  7. "tiny", "tiny.en",
  8. "base", "base.en",
  9. "small", "small.en",
  10. "medium", "medium.en",
  11. "large", "large-v1",
  12. "large-v2", "large-v3"]
  13. for i, size in enumerate(model_size_list):
  14. if os.path.exists(f'tools/asr/models/faster-whisper-{size}'):
  15. model_size_list[i] = size + '-local'
  16. return model_size_list
  17. asr_dict = {
  18. "达摩 ASR (中文)": {
  19. 'lang': ['zh'],
  20. 'size': ['large'],
  21. 'path': 'funasr_asr.py',
  22. },
  23. "Faster Whisper (多语种)": {
  24. 'lang': ['auto', 'zh', 'en', 'ja'],
  25. 'size': check_fw_local_models(),
  26. 'path': 'fasterwhisper_asr.py'
  27. }
  28. }