Spaces:
Running
on
Zero
Running
on
Zero
Update whisper_cs.py
#32
by
ssolito
- opened
- whisper_cs.py +1 -2
whisper_cs.py
CHANGED
@@ -46,7 +46,6 @@ def format_audio(audio_path):
|
|
46 |
input_audio = torch.mean(input_audio, dim=0, keepdim=True)
|
47 |
resampler = torchaudio.transforms.Resample(orig_freq=sample_rate, new_freq=16000)
|
48 |
input_audio = resampler(input_audio)
|
49 |
-
print('resampled')
|
50 |
return input_audio.squeeze(), 16000
|
51 |
|
52 |
def post_process_transcription(transcription, max_repeats=2):
|
@@ -105,7 +104,7 @@ def cleanup_temp_files(*file_paths):
|
|
105 |
if path and os.path.exists(path):
|
106 |
os.remove(path)
|
107 |
|
108 |
-
faster_model = WhisperModel(MODEL_PATH_V2_FAST, device=DEVICE, compute_type="
|
109 |
|
110 |
def load_whisper_model(model_path: str):
|
111 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
|
|
46 |
input_audio = torch.mean(input_audio, dim=0, keepdim=True)
|
47 |
resampler = torchaudio.transforms.Resample(orig_freq=sample_rate, new_freq=16000)
|
48 |
input_audio = resampler(input_audio)
|
|
|
49 |
return input_audio.squeeze(), 16000
|
50 |
|
51 |
def post_process_transcription(transcription, max_repeats=2):
|
|
|
104 |
if path and os.path.exists(path):
|
105 |
os.remove(path)
|
106 |
|
107 |
+
faster_model = WhisperModel(MODEL_PATH_V2_FAST, device=DEVICE, compute_type="float16")
|
108 |
|
109 |
def load_whisper_model(model_path: str):
|
110 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|