Update gladia.py (#1317)

* Update gladia.py

According to gladia docs 
https://docs.gladia.io/api-reference/v2/live/init
speech threshould value close to 1 enables gladia to better isolate speeech from noise.
This commit is contained in:
allenmylath
2025-03-03 23:21:11 +05:30
committed by GitHub
parent d6867bd12f
commit 5f1848d24b

View File

@@ -136,7 +136,7 @@ class GladiaSTTService(STTService):
maximum_duration_without_endpointing: Optional[int] = 10
audio_enhancer: Optional[bool] = None
words_accurate_timestamps: Optional[bool] = None
speech_threshold: Optional[float] = .99
def __init__(
self,
*,
@@ -144,11 +144,10 @@ class GladiaSTTService(STTService):
url: str = "https://api.gladia.io/v2/live",
confidence: float = 0.5,
sample_rate: Optional[int] = None,
params: InputParams = InputParams(),
params: InputParams = InputParams(),
**kwargs,
):
super().__init__(sample_rate=sample_rate, **kwargs)
self._api_key = api_key
self._url = url
self._settings = {
@@ -166,6 +165,7 @@ class GladiaSTTService(STTService):
"maximum_duration_without_endpointing": params.maximum_duration_without_endpointing,
"pre_processing": {
"audio_enhancer": params.audio_enhancer,
"speech_threshold": params.speech_threshold,
},
"realtime_processing": {
"words_accurate_timestamps": params.words_accurate_timestamps,