faster-whisper === source:https://github.com/SYSTRAN/faster-whisper 操作步驟 === 1. 安裝Visual Studio 記得勾選Python development https://visualstudio.microsoft.com/vs/community/ 2. 開啟Visual Studio新專案 ![image](https://hackmd.io/_uploads/rJaiAeofkl.png) 3. 建立Python應用程式 ![image](https://hackmd.io/_uploads/Bk6lJWjfye.png) 4. 設定專案名稱 5. 貼上Python Script 記得變更音檔檔名(audio.mp3)、文字稿檔名(transcript.mp3) ``` from faster_whisper import WhisperModel model_size = "large-v3" # 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) print("Detected language '%s' with probability %f" % (info.language, info.language_probability)) f = open("transcript.txt", "a",encoding="utf-8") for segment in segments: #print("[%.2fs -> %.2fs] %s" % (segment.start, segment.end, segment.text)) f.write("[%.2fs -> %.2fs] %s" % (segment.start, segment.end, segment.text)) f.write("\n") f.close() ``` 6.點「開始」 ![image](https://hackmd.io/_uploads/H1YWWZofJl.png) 7.畫面會提示需要安裝Python 直接安裝,有權限問題找機房人員處理 8.Python環境(右鍵)->檢視所有Python環境 ![image](https://hackmd.io/_uploads/rkz2bbjfkx.png) 9.安裝faster-whisper(PyPI套件) ![image](https://hackmd.io/_uploads/SkQQfWif1l.png) 10.點「開始」,等待一下子「Detected language...」會先跑出來,接著會寫入音檔文字稿(transcript.txt),音檔長度越長等越久。 ![image](https://hackmd.io/_uploads/BkqCX-iMyl.png) ![image](https://hackmd.io/_uploads/BkPemzoM1x.png)