Liusuthu commited on
Commit
1991296
·
verified ·
1 Parent(s): d4a309a

Update app_utils.py

Browse files
Files changed (1) hide show
  1. app_utils.py +8 -3
app_utils.py CHANGED
@@ -105,9 +105,9 @@ def text_score(text):
105
  want2 = part2[2]
106
  prob = float(want2[3:-4])
107
  if label=="正向":
108
- score=-prob*10
109
  else:
110
- score=prob*10
111
  # print("from func:text_score————,text:",text,",score:",score)
112
  return text,score
113
 
@@ -147,12 +147,17 @@ def speech_score(audio):
147
  prob=out_prob.squeeze(0).numpy()
148
  #print(prob)
149
  score2=10*prob[0]-10*prob[1]
 
 
 
 
150
  # print("from func:speech_score————score2:",score2)
151
  # print("from func:speech_score————",text_lab[-1])
 
152
  text,score1=text_score(text_results)
153
  # # text_emo=str(get_text_score(text_results))
154
  # print("from func:speech_score————text:",text,",score1:",score1)
155
- score=score1+score2
156
 
157
 
158
  return text,score
 
105
  want2 = part2[2]
106
  prob = float(want2[3:-4])
107
  if label=="正向":
108
+ score=-np.log10(prob*10)
109
  else:
110
+ score=np.log10(prob*10)
111
  # print("from func:text_score————,text:",text,",score:",score)
112
  return text,score
113
 
 
147
  prob=out_prob.squeeze(0).numpy()
148
  #print(prob)
149
  score2=10*prob[0]-10*prob[1]
150
+ if score2>=0:
151
+ score2=np.log10(score2)
152
+ else:
153
+ score2=-np.log10(-score2)
154
  # print("from func:speech_score————score2:",score2)
155
  # print("from func:speech_score————",text_lab[-1])
156
+
157
  text,score1=text_score(text_results)
158
  # # text_emo=str(get_text_score(text_results))
159
  # print("from func:speech_score————text:",text,",score1:",score1)
160
+ score=(2/3)*score1+(1/3)*score2
161
 
162
 
163
  return text,score