hungshinlee commited on
Commit
dc31fd6
·
verified ·
1 Parent(s): 22eb6d8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
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.4
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
- threshold = THRESHOLD_H
58
  else:
59
- threshold = THRESHOLD_G
60
- if conf_result[0] > threshold and conf_result[1] > threshold:
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
  )