Spaces:
Runtime error
Runtime error
Update consult.py
Browse files- consult.py +17 -15
consult.py
CHANGED
@@ -67,9 +67,9 @@ def video_score4(video):
|
|
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)
|
71 |
else:
|
72 |
-
return text,score,gr.Radio(visible=False), gr.Column(visible=True)
|
73 |
|
74 |
|
75 |
|
@@ -154,22 +154,24 @@ with gr.Blocks() as consult:
|
|
154 |
result3_12 = gr.Textbox(label="分数结果3_1")
|
155 |
# 请把audio3_2换成Audio组件
|
156 |
with gr.Column(visible=False) as ans3_2: # 语音回答
|
157 |
-
audio3_2 = gr.
|
158 |
-
label="
|
159 |
) # 对应out_prob.squeeze(0).numpy()[0]
|
160 |
btn3_2 = gr.Button("抱抱你")
|
|
|
|
|
161 |
# 请把video3_3换成Video组件
|
162 |
with gr.Column(visible=False) as ans3_3: # 视频回答
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
# 自杀倾向问题
|
174 |
radio8 = gr.Radio(
|
175 |
["想过", "没想过"],
|
@@ -284,7 +286,7 @@ with gr.Blocks() as consult:
|
|
284 |
radio5.change(visibility_choice3, radio5, [radio6, q3_2, q4])
|
285 |
radio6.change(visibility, outputs=q3_2)
|
286 |
radio7.change(visibility_choice2, radio7, [ans3_1, ans3_2, ans3_3])
|
287 |
-
btn3_1.click(text_score3, text3_1, [result3_11,result3_12,radio8, q4])
|
288 |
# 关于btn3_2,btn3_3:请你设计一个函数把语音/视频中文本提取出来,然后经过keyword函数判定来决定要不要出现radio8
|
289 |
radio8.change(visibility_choice4, radio8, [radio9, q4])
|
290 |
radio9.change(visibility_choice4, radio9, [radio10, q4])
|
|
|
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 |
|
75 |
|
|
|
154 |
result3_12 = gr.Textbox(label="分数结果3_1")
|
155 |
# 请把audio3_2换成Audio组件
|
156 |
with gr.Column(visible=False) as ans3_2: # 语音回答
|
157 |
+
audio3_2 = gr.Audio(
|
158 |
+
label="语音录制", interactive=True, sources=["microphone"]
|
159 |
) # 对应out_prob.squeeze(0).numpy()[0]
|
160 |
btn3_2 = gr.Button("抱抱你")
|
161 |
+
result3_21 = gr.Textbox(label="结果3_2")
|
162 |
+
result3_22 = gr.Textbox(label="分数结果3_2")
|
163 |
# 请把video3_3换成Video组件
|
164 |
with gr.Column(visible=False) as ans3_3: # 视频回答
|
165 |
+
video3_3 = gr.Video(
|
166 |
+
sources=["webcam", "upload"],
|
167 |
+
interactive=True,
|
168 |
+
format='mp4',
|
169 |
+
width=500,
|
170 |
+
)
|
171 |
+
btn3_3 = gr.Button("继续")
|
172 |
+
result3_31 = gr.Textbox(label="结果3_3")
|
173 |
+
result3_32 = gr.Textbox(label="分数结果3_3")
|
174 |
+
|
175 |
# 自杀倾向问题
|
176 |
radio8 = gr.Radio(
|
177 |
["想过", "没想过"],
|
|
|
286 |
radio5.change(visibility_choice3, radio5, [radio6, q3_2, q4])
|
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])
|