feat: add model/MODEL_NAME parameters
Some checks failed
Python tests / tests (push) Failing after 8s
Some checks failed
Python tests / tests (push) Failing after 8s
in order to allow for better efficiency and consistency
This commit is contained in:
@@ -1,5 +1,11 @@
|
||||
import re
|
||||
|
||||
try:
|
||||
from settings import MODEL_NAME
|
||||
except ImportError:
|
||||
print("settings.py nicht gefunden, verwende settings_example.py")
|
||||
from settings_example import MODEL_NAME
|
||||
|
||||
# Mapping von gesprochenen Buchstaben (deutsch) auf Zeichen
|
||||
SPOKEN_TO_CHAR = {
|
||||
"a": "a", "ah": "a",
|
||||
@@ -60,9 +66,11 @@ def _normalize_transcription(raw_text):
|
||||
print(f"Unbekanntes Token: '{token}'")
|
||||
return ''.join(result)
|
||||
|
||||
def transcribe_audio_with_whisper(mp3_path):
|
||||
import whisper
|
||||
model = whisper.load_model("small")
|
||||
def transcribe_audio_with_whisper(mp3_path, model=None):
|
||||
if model is None:
|
||||
import whisper
|
||||
model = whisper.load_model(MODEL_NAME)
|
||||
|
||||
result = model.transcribe(str(mp3_path), language='de')
|
||||
raw_text = result["text"]
|
||||
print("Raw transcription:", raw_text)
|
||||
|
||||
Reference in New Issue
Block a user