Update app.py
Browse files
app.py
CHANGED
|
@@ -9,7 +9,7 @@ from omegaconf import OmegaConf
|
|
| 9 |
from vosk import KaldiRecognizer, Model
|
| 10 |
|
| 11 |
THRESHOLD_G = 0.5
|
| 12 |
-
THRESHOLD_H = 0.
|
| 13 |
|
| 14 |
|
| 15 |
def load_vosk(model_id: str):
|
|
@@ -54,10 +54,10 @@ def automatic_speech_recognition(model_id: str, stream: str, new_chunk: str):
|
|
| 54 |
|
| 55 |
conf_result = (round(result["result"][0]["conf"], 3), round(result["result"][1]["conf"], 3))
|
| 56 |
if "HI" in word or "HEY" in word:
|
| 57 |
-
|
| 58 |
else:
|
| 59 |
-
|
| 60 |
-
if conf_result[0] >
|
| 61 |
results.append(
|
| 62 |
datetime.datetime.now(pytz.timezone("Asia/Taipei")).strftime("%H:%M:%S") + " " + text_result
|
| 63 |
)
|
|
|
|
| 9 |
from vosk import KaldiRecognizer, Model
|
| 10 |
|
| 11 |
THRESHOLD_G = 0.5
|
| 12 |
+
THRESHOLD_H = 0.34
|
| 13 |
|
| 14 |
|
| 15 |
def load_vosk(model_id: str):
|
|
|
|
| 54 |
|
| 55 |
conf_result = (round(result["result"][0]["conf"], 3), round(result["result"][1]["conf"], 3))
|
| 56 |
if "HI" in word or "HEY" in word:
|
| 57 |
+
threshold_1 = THRESHOLD_H
|
| 58 |
else:
|
| 59 |
+
threshold_1 = THRESHOLD_G
|
| 60 |
+
if conf_result[0] > threshold_1 and conf_result[1] > THRESHOLD_G:
|
| 61 |
results.append(
|
| 62 |
datetime.datetime.now(pytz.timezone("Asia/Taipei")).strftime("%H:%M:%S") + " " + text_result
|
| 63 |
)
|