init
This commit is contained in:
20
test004.py
Normal file
20
test004.py
Normal file
@@ -0,0 +1,20 @@
|
||||
from faster_whisper import WhisperModel
|
||||
|
||||
model_size = "turbo"
|
||||
|
||||
# Run on GPU with FP16
|
||||
model = WhisperModel(model_size, device="cuda", compute_type="float16")
|
||||
|
||||
# or run on GPU with INT8
|
||||
# model = WhisperModel(model_size, device="cuda", compute_type="int8_float16")
|
||||
# or run on CPU with INT8
|
||||
# model = WhisperModel(model_size, device="cpu", compute_type="int8")
|
||||
|
||||
segments, info = model.transcribe("audio.mp3", beam_size=5, language="zh", initial_prompt="这是一段小说。")
|
||||
|
||||
print(info)
|
||||
|
||||
print("Detected language '%s' with probability %f" % (info.language, info.language_probability))
|
||||
|
||||
for segment in segments:
|
||||
print("[%.2fs -> %.2fs] %s" % (segment.start, segment.end, segment.text))
|
Reference in New Issue
Block a user