eightban's memo

残しておきたい記事をまとめてみました。このブログに書いてあるドキュメントやブログで配布しているファイルの使用によって発生するいかなる損害に対してもこのブログの管理者は責任を負いません。使用する場合は自己責任のもとに使用してください。

Python

リアルタイムなWhisper-WebUIを Windows パソコンで動かす

投稿日:

インストール

次のプログラムを使用させていただきます

[ローカル環境] faster-whisperを利用してリアルタイム文字起こしに挑戦 #Python - Qiita

GitHub - reriiasu/speech-to-text: Real-time transcription using faster-whisper

Sounddevice を使用してマイクからのオーディオ入力を受け入れます。Silero VAD(Voice Activity Detection)を利用することで、無音部分を検出し、1つの音声データとして認識します。この音声データは、Faster-Whisper を使用してテキストに変換されます。

"D:\WinPython\WinPython Command Prompt.exe"
git clone https://github.com/reriiasu/speech-to-text
cd speech-to-text

仮想環境を作成してインストール

python.exe -m venv venv --system-site-packages
venv\Scripts\activate
pip install -r requirements.txt
python -m speech_to_text

インストールと起動のバッチファイル

@echo off
call %~dp0\scripts\env_for_icons.bat  %*
SET PATH=%PATH%;%WINPYDIRBASE%\PortableGit;%WINPYDIRBASE%\PortableGit\bin
SET PATH=%PATH%;%WINPYDIRBASE%\ffmpeg\bin
If not exist %WINPYDIRBASE%\content mkdir  %WINPYDIRBASE%\content 

set APP_NAME=speech-to-text
set APP_DIR=%WINPYDIRBASE%\content\%APP_NAME%
echo %APP_DIR%

If not exist %APP_DIR% git clone https://github.com/reriiasu/speech-to-text
cd %APP_DIR%
if not defined VENV_DIR (set "VENV_DIR=%APP_DIR%\venv")
if EXIST %VENV_DIR% goto :activate_venv


::python.exe -m venv "%VENV_DIR%" 
python.exe -m venv "%VENV_DIR%" --system-site-packages 
if %ERRORLEVEL% == 0 goto :activate_venv
echo Unable to create venv 
goto :skip_venv

:activate_venv
call "%VENV_DIR%\Scripts\activate"
If  exist %WINPYDIRBASE%\content\%APP_NAME%\venv\Lib\site-packages\faster_whisper goto :skip_cmd
pip install -r requirements.txt

::cmd.exe /k
goto :skip_venv
:skip_cmd
python -m speech_to_text
:skip_venv
::
cmd.exe /k

モデルと言語を変更して使用してください

-Python

Copyright© eightban's memo , 2024 All Rights Reserved Powered by STINGER.