Spaces:
Running
Running
jhj0517
commited on
Commit
·
e9e1347
1
Parent(s):
c93f2d3
Use enum
Browse files
modules/whisper/whisper_factory.py
CHANGED
@@ -7,6 +7,7 @@ from modules.whisper.faster_whisper_inference import FasterWhisperInference
|
|
7 |
from modules.whisper.whisper_Inference import WhisperInference
|
8 |
from modules.whisper.insanely_fast_whisper_inference import InsanelyFastWhisperInference
|
9 |
from modules.whisper.whisper_base import WhisperBase
|
|
|
10 |
|
11 |
|
12 |
class WhisperFactory:
|
@@ -51,30 +52,21 @@ class WhisperFactory:
|
|
51 |
# Temporal fix of the bug : https://github.com/jhj0517/Whisper-WebUI/issues/144
|
52 |
os.environ['KMP_DUPLICATE_LIB_OK'] = 'True'
|
53 |
|
54 |
-
whisper_type
|
55 |
-
|
56 |
-
faster_whisper_typos = ["faster_whisper", "faster-whisper", "fasterwhisper"]
|
57 |
-
whisper_typos = ["whisper"]
|
58 |
-
insanely_fast_whisper_typos = [
|
59 |
-
"insanely_fast_whisper", "insanely-fast-whisper", "insanelyfastwhisper",
|
60 |
-
"insanely_faster_whisper", "insanely-faster-whisper", "insanelyfasterwhisper"
|
61 |
-
]
|
62 |
-
|
63 |
-
if whisper_type in faster_whisper_typos:
|
64 |
return FasterWhisperInference(
|
65 |
model_dir=faster_whisper_model_dir,
|
66 |
output_dir=output_dir,
|
67 |
diarization_model_dir=diarization_model_dir,
|
68 |
uvr_model_dir=uvr_model_dir
|
69 |
)
|
70 |
-
elif whisper_type in
|
71 |
return WhisperInference(
|
72 |
model_dir=whisper_model_dir,
|
73 |
output_dir=output_dir,
|
74 |
diarization_model_dir=diarization_model_dir,
|
75 |
uvr_model_dir=uvr_model_dir
|
76 |
)
|
77 |
-
elif whisper_type in
|
78 |
return InsanelyFastWhisperInference(
|
79 |
model_dir=insanely_fast_whisper_model_dir,
|
80 |
output_dir=output_dir,
|
|
|
7 |
from modules.whisper.whisper_Inference import WhisperInference
|
8 |
from modules.whisper.insanely_fast_whisper_inference import InsanelyFastWhisperInference
|
9 |
from modules.whisper.whisper_base import WhisperBase
|
10 |
+
from modules.whisper.data_classes import *
|
11 |
|
12 |
|
13 |
class WhisperFactory:
|
|
|
52 |
# Temporal fix of the bug : https://github.com/jhj0517/Whisper-WebUI/issues/144
|
53 |
os.environ['KMP_DUPLICATE_LIB_OK'] = 'True'
|
54 |
|
55 |
+
if whisper_type == WhisperImpl.FASTER_WHISPER:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
return FasterWhisperInference(
|
57 |
model_dir=faster_whisper_model_dir,
|
58 |
output_dir=output_dir,
|
59 |
diarization_model_dir=diarization_model_dir,
|
60 |
uvr_model_dir=uvr_model_dir
|
61 |
)
|
62 |
+
elif whisper_type in WhisperImpl.WHISPER:
|
63 |
return WhisperInference(
|
64 |
model_dir=whisper_model_dir,
|
65 |
output_dir=output_dir,
|
66 |
diarization_model_dir=diarization_model_dir,
|
67 |
uvr_model_dir=uvr_model_dir
|
68 |
)
|
69 |
+
elif whisper_type in WhisperImpl.INSANELY_FAST_WHISPER:
|
70 |
return InsanelyFastWhisperInference(
|
71 |
model_dir=insanely_fast_whisper_model_dir,
|
72 |
output_dir=output_dir,
|