Add whisper to feature complete requirements

This commit is contained in:
SillyLossy
2023-03-05 13:46:07 +02:00
parent 6c35888f3c
commit ffeffc6718
2 changed files with 20 additions and 0 deletions

View File

@@ -9,6 +9,8 @@ torchvision >= 0.9, < 0.13
torchaudio >= 0.9, < 0.13
numpy
accelerate
SpeechRecognition~=3.9.0
git+https://github.com/huggingface/transformers
git+https://github.com/huggingface/diffusers
git+https://github.com/coqui-ai/TTS
git+https://github.com/openai/whisper

18
stt.py Normal file
View File

@@ -0,0 +1,18 @@
import speech_recognition as sr
import whisper
english = True
def init_stt(model="base", english=True, energy=300, pause=0.8, dynamic_energy=False):
if model != "large" and english:
model = model + ".en"
audio_model = whisper.load_model(model)
r = sr.Recognizer()
r.energy_threshold = energy
r.pause_threshold = pause
r.dynamic_energy_threshold = dynamic_energy
return r, audio_model
r, audio_model = init_stt()