Spaces:
Runtime error
Runtime error
Update consult.py
Browse files- consult.py +22 -19
consult.py
CHANGED
@@ -51,39 +51,39 @@ punc = CttPunctuator()
|
|
51 |
#第四题专用函数:(经过调整,第五题也可以用)
|
52 |
def text_score4(text):
|
53 |
text,score=text_score(text)
|
54 |
-
return text,score,gr.Column(visible=True),score
|
55 |
|
56 |
|
57 |
def speech_score4(audio):
|
58 |
text,score=speech_score(audio)
|
59 |
-
return text,score,gr.Column(visible=True),score
|
60 |
|
61 |
|
62 |
def video_score4(video):
|
63 |
text,score=video_score(video)
|
64 |
-
return text,score,gr.Column(visible=True),score
|
65 |
#########################################################################################
|
66 |
#第三题专用函数:(融入keyword识别)
|
67 |
def text_score3(text):
|
68 |
text,score=text_score(text)
|
69 |
if keyword(text):
|
70 |
-
return text,score,gr.Radio(visible=True), gr.Column(visible=False),score
|
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
|
@@ -93,8 +93,11 @@ schema = "情感倾向[正向,负向]" # Define the schema for sentence-level
|
|
93 |
with gr.Blocks() as consult:
|
94 |
gr.Markdown("调试分数")
|
95 |
result1=gr.Number(label="第一道问答题分数",interactive=True,)
|
|
|
96 |
result2=gr.Number(label="第二道问答题分数",interactive=True,)
|
|
|
97 |
result3=gr.Number(label="第三道问答题分数",interactive=True,)
|
|
|
98 |
gr.Markdown(
|
99 |
"欢迎来到这里,接下来我们来放松地聊聊天,你只要如实完整地回答我的问题就好了。"
|
100 |
)
|
@@ -296,23 +299,23 @@ with gr.Blocks() as consult:
|
|
296 |
radio5.change(visibility_choice3, radio5, [radio6, q3_2, q4])
|
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])
|
305 |
radio10.change(visibility, outputs=q4)
|
306 |
radio10.change(visibility4, outputs=dead_hug)
|
307 |
radio11.change(visibility_choice2, radio11, [ans4_1, ans4_2, ans4_3])
|
308 |
-
btn4_1.click(text_score4,inputs=text4_1, outputs=[result4_11,result4_12,q5,result2])
|
309 |
-
btn4_2.click(speech_score4, inputs=audio4_2, outputs=[result4_21,result4_22,q5,result2])
|
310 |
-
btn4_3.click(video_score4, inputs=video4_3, outputs=[result4_31,result4_32,q5,result2])
|
311 |
radio12.change(visibility_choice2, radio12, [ans5_1, ans5_2, ans5_3])
|
312 |
|
313 |
-
btn5_1.click(text_score4,inputs=text5_1, outputs=[result5_11,result5_12,summary,result3])
|
314 |
-
btn5_2.click(speech_score4, inputs=audio5_2, outputs=[result5_21,result5_22,summary,result3])
|
315 |
-
btn5_3.click(video_score4, inputs=video5_3, outputs=[result5_31,result5_32,summary,result3])
|
316 |
|
317 |
summary_button.click(
|
318 |
advice,
|
@@ -323,7 +326,7 @@ with gr.Blocks() as consult:
|
|
323 |
radio4,
|
324 |
radio5,
|
325 |
radio6,
|
326 |
-
|
327 |
radio8,
|
328 |
radio9,
|
329 |
radio10,
|
|
|
51 |
#第四题专用函数:(经过调整,第五题也可以用)
|
52 |
def text_score4(text):
|
53 |
text,score=text_score(text)
|
54 |
+
return text,score,gr.Column(visible=True),text,score
|
55 |
|
56 |
|
57 |
def speech_score4(audio):
|
58 |
text,score=speech_score(audio)
|
59 |
+
return text,score,gr.Column(visible=True),text,score
|
60 |
|
61 |
|
62 |
def video_score4(video):
|
63 |
text,score=video_score(video)
|
64 |
+
return text,score,gr.Column(visible=True),text,score
|
65 |
#########################################################################################
|
66 |
#第三题专用函数:(融入keyword识别)
|
67 |
def text_score3(text):
|
68 |
text,score=text_score(text)
|
69 |
if keyword(text):
|
70 |
+
return text,score,gr.Radio(visible=True), gr.Column(visible=False),text,score
|
71 |
else:
|
72 |
+
return text,score,gr.Radio(visible=False), gr.Column(visible=True),text,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),text,score
|
78 |
else:
|
79 |
+
return text,score,gr.Radio(visible=False), gr.Column(visible=True),text,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),text,score
|
85 |
else:
|
86 |
+
return text,score,gr.Radio(visible=False), gr.Column(visible=True),text,score
|
87 |
#########################################################################################
|
88 |
|
89 |
# constants
|
|
|
93 |
with gr.Blocks() as consult:
|
94 |
gr.Markdown("调试分数")
|
95 |
result1=gr.Number(label="第一道问答题分数",interactive=True,)
|
96 |
+
text1=gr.Textbox(label="第一道问答题回答内容",interactive=True,)
|
97 |
result2=gr.Number(label="第二道问答题分数",interactive=True,)
|
98 |
+
text2=gr.Textbox(label="第二道问答题回答内容",interactive=True,)
|
99 |
result3=gr.Number(label="第三道问答题分数",interactive=True,)
|
100 |
+
text3=gr.Textbox(label="第三道问答题回答内容",interactive=True,)
|
101 |
gr.Markdown(
|
102 |
"欢迎来到这里,接下来我们来放松地聊聊天,你只要如实完整地回答我的问题就好了。"
|
103 |
)
|
|
|
299 |
radio5.change(visibility_choice3, radio5, [radio6, q3_2, q4])
|
300 |
radio6.change(visibility, outputs=q3_2)
|
301 |
radio7.change(visibility_choice2, radio7, [ans3_1, ans3_2, ans3_3])
|
302 |
+
btn3_1.click(text_score3, text3_1, [result3_11,result3_12,radio8, q4,text1,result1])
|
303 |
+
btn3_2.click(speech_score3,audio3_2, [result3_21,result3_22,radio8, q4,text1,result1])
|
304 |
+
btn3_3.click(speech_score3,video3_3, [result3_31,result3_32,radio8, q4,text1,result1])
|
305 |
# 关于btn3_2,btn3_3:请你设计一个函数把语音/视频中文本提取出来,然后经过keyword函数判定来决定要不要出现radio8
|
306 |
radio8.change(visibility_choice4, radio8, [radio9, q4])
|
307 |
radio9.change(visibility_choice4, radio9, [radio10, q4])
|
308 |
radio10.change(visibility, outputs=q4)
|
309 |
radio10.change(visibility4, outputs=dead_hug)
|
310 |
radio11.change(visibility_choice2, radio11, [ans4_1, ans4_2, ans4_3])
|
311 |
+
btn4_1.click(text_score4,inputs=text4_1, outputs=[result4_11,result4_12,q5,text2,result2])
|
312 |
+
btn4_2.click(speech_score4, inputs=audio4_2, outputs=[result4_21,result4_22,q5,text2,result2])
|
313 |
+
btn4_3.click(video_score4, inputs=video4_3, outputs=[result4_31,result4_32,q5,text2,result2])
|
314 |
radio12.change(visibility_choice2, radio12, [ans5_1, ans5_2, ans5_3])
|
315 |
|
316 |
+
btn5_1.click(text_score4,inputs=text5_1, outputs=[result5_11,result5_12,summary,text3,result3])
|
317 |
+
btn5_2.click(speech_score4, inputs=audio5_2, outputs=[result5_21,result5_22,summary,text3,result3])
|
318 |
+
btn5_3.click(video_score4, inputs=video5_3, outputs=[result5_31,result5_32,summary,text3,result3])
|
319 |
|
320 |
summary_button.click(
|
321 |
advice,
|
|
|
326 |
radio4,
|
327 |
radio5,
|
328 |
radio6,
|
329 |
+
text3,
|
330 |
radio8,
|
331 |
radio9,
|
332 |
radio10,
|