Liusuthu commited on
Commit
c11a543
·
verified ·
1 Parent(s): 7a4af8e

Update app_utils.py

Browse files
Files changed (1) hide show
  1. app_utils.py +24 -24
app_utils.py CHANGED
@@ -108,7 +108,7 @@ def text_score(text):
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
 
114
  def speech_score(audio):
@@ -137,21 +137,21 @@ def speech_score(audio):
137
  text_results += punc.punctuate(_result)[0]
138
 
139
  out_prob, score, index, text_lab = classifier.classify_batch(signal1)
140
- print("from func:speech_score————type and value of prob:")
141
- print(type(out_prob.squeeze(0).numpy()))
142
- print(out_prob.squeeze(0).numpy())
143
- print("from func:speech_score————type and value of resul_label:")
144
- print(type(text_lab[-1]))
145
- print(text_lab[-1])
146
  #return text_results, out_prob.squeeze(0).numpy(), text_lab[-1], 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
 
@@ -268,11 +268,11 @@ def video_score(video):
268
  return None, None
269
 
270
  #for debug
271
- print("from func:video_score————")
272
- print(type(frames))
273
- print(frames)
274
- print(type(probs))
275
- print(probs)
276
  # to calculate scores
277
  nan=float('nan')
278
  s1 = 0
@@ -304,14 +304,14 @@ def video_score(video):
304
  scores=[s1,s2,s3,s4,s5,s6,s7]
305
  scores_str=str(scores)
306
  score1=0*scores[0]-8*scores[1]+4*scores[2]+0*scores[3]+2*scores[4]+2*scores[5]+4*scores[6]
307
- print("from func:video_score————score1=",score1)
308
- print("from func:video_score————logs:")
309
- with open("local_data/data.txt",'a', encoding="utf8") as f:
310
- f.write(scores_str+'\n')
311
 
312
- with open("local_data/data.txt",'r', encoding="utf8") as f:
313
- for i in f:
314
- print(i)
315
 
316
 
317
  #trans the audio file
@@ -322,10 +322,10 @@ def video_score(video):
322
 
323
  text,score2=speech_score(audio)
324
 
325
- print("from func:video_score————text:",text)
326
 
327
  score=score2+score1
328
- print("from func:video_score————score:",score)
329
  return text,score
330
  #######################################################################
331
 
 
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
 
114
  def speech_score(audio):
 
137
  text_results += punc.punctuate(_result)[0]
138
 
139
  out_prob, score, index, text_lab = classifier.classify_batch(signal1)
140
+ # print("from func:speech_score————type and value of prob:")
141
+ # print(type(out_prob.squeeze(0).numpy()))
142
+ # print(out_prob.squeeze(0).numpy())
143
+ # print("from func:speech_score————type and value of resul_label:")
144
+ # print(type(text_lab[-1]))
145
+ # print(text_lab[-1])
146
  #return text_results, out_prob.squeeze(0).numpy(), text_lab[-1], 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
 
 
268
  return None, None
269
 
270
  #for debug
271
+ #print("from func:video_score————")
272
+ # print(type(frames))
273
+ # print(frames)
274
+ # print(type(probs))
275
+ # print(probs)
276
  # to calculate scores
277
  nan=float('nan')
278
  s1 = 0
 
304
  scores=[s1,s2,s3,s4,s5,s6,s7]
305
  scores_str=str(scores)
306
  score1=0*scores[0]-8*scores[1]+4*scores[2]+0*scores[3]+2*scores[4]+2*scores[5]+4*scores[6]
307
+ #print("from func:video_score————score1=",score1)
308
+ #print("from func:video_score————logs:")
309
+ # with open("local_data/data.txt",'a', encoding="utf8") as f:
310
+ # f.write(scores_str+'\n')
311
 
312
+ # with open("local_data/data.txt",'r', encoding="utf8") as f:
313
+ # for i in f:
314
+ # print(i)
315
 
316
 
317
  #trans the audio file
 
322
 
323
  text,score2=speech_score(audio)
324
 
325
+ #print("from func:video_score————text:",text)
326
 
327
  score=score2+score1
328
+ #print("from func:video_score————score:",score)
329
  return text,score
330
  #######################################################################
331