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

Update consult.py

Browse files
Files changed (1) hide show
  1. consult.py +14 -2
consult.py CHANGED
@@ -71,9 +71,19 @@ def text_score3(text):
71
  else:
72
  return text,score,gr.Radio(visible=False), gr.Column(visible=True),score
73
 
 
 
 
 
 
 
74
 
75
-
76
-
 
 
 
 
77
  #########################################################################################
78
 
79
  # constants
@@ -287,6 +297,8 @@ with gr.Blocks() as consult:
287
  radio6.change(visibility, outputs=q3_2)
288
  radio7.change(visibility_choice2, radio7, [ans3_1, ans3_2, ans3_3])
289
  btn3_1.click(text_score3, text3_1, [result3_11,result3_12,radio8, q4,result1])
 
 
290
  # 关于btn3_2,btn3_3:请你设计一个函数把语音/视频中文本提取出来,然后经过keyword函数判定来决定要不要出现radio8
291
  radio8.change(visibility_choice4, radio8, [radio9, q4])
292
  radio9.change(visibility_choice4, radio9, [radio10, q4])
 
71
  else:
72
  return text,score,gr.Radio(visible=False), gr.Column(visible=True),score
73
 
74
+ def speech_score3(audio):
75
+ text,score=speech_score(audio)
76
+ if keyword(text):
77
+ return text,score,gr.Radio(visible=True), gr.Column(visible=False),score
78
+ else:
79
+ return text,score,gr.Radio(visible=False), gr.Column(visible=True),score
80
 
81
+ def video_score3(video):
82
+ text,score=video_score(video)
83
+ if keyword(text):
84
+ return text,score,gr.Radio(visible=True), gr.Column(visible=False),score
85
+ else:
86
+ return text,score,gr.Radio(visible=False), gr.Column(visible=True),score
87
  #########################################################################################
88
 
89
  # constants
 
297
  radio6.change(visibility, outputs=q3_2)
298
  radio7.change(visibility_choice2, radio7, [ans3_1, ans3_2, ans3_3])
299
  btn3_1.click(text_score3, text3_1, [result3_11,result3_12,radio8, q4,result1])
300
+ btn3_2.click(speech_score3,audio3_2, [result3_21,result3_22,radio8, q4,result1])
301
+ btn3_3.click(speech_score3,video3_3, [result3_31,result3_32,radio8, q4,result1])
302
  # 关于btn3_2,btn3_3:请你设计一个函数把语音/视频中文本提取出来,然后经过keyword函数判定来决定要不要出现radio8
303
  radio8.change(visibility_choice4, radio8, [radio9, q4])
304
  radio9.change(visibility_choice4, radio9, [radio10, q4])