Liusuthu commited on
Commit
dc88262
·
verified ·
1 Parent(s): 792e702

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -1
app.py CHANGED
@@ -40,6 +40,15 @@ def text_api(text:str):
40
  return result
41
 
42
 
 
 
 
 
 
 
 
 
 
43
  def classify_continuous(audio):
44
  print(type(audio))
45
  print(audio)
@@ -109,7 +118,7 @@ def speech_score(audio):
109
  score2=10*prob[0]-10*prob[1]
110
  print("score2",score2)
111
  print(text_lab[-1])
112
- text_emo=text_api(text_results)
113
  print(text_emo)
114
 
115
  return score2,text_emo
 
40
  return result
41
 
42
 
43
+ def get_text_score(text):
44
+ part1 = str.partition(string, r"text")
45
+ want1 = part1[2]
46
+ label = want1[4:6]
47
+ part2 = str.partition(string, r"probability")
48
+ want2 = part2[2]
49
+ prob = float(want2[3:-4])
50
+ return label, prob
51
+
52
  def classify_continuous(audio):
53
  print(type(audio))
54
  print(audio)
 
118
  score2=10*prob[0]-10*prob[1]
119
  print("score2",score2)
120
  print(text_lab[-1])
121
+ text_emo=str(get_text_score(text_api(text_results)))
122
  print(text_emo)
123
 
124
  return score2,text_emo