Liusuthu commited on
Commit
08a1946
·
verified ·
1 Parent(s): 24c36c5

Update consult.py

Browse files
Files changed (1) hide show
  1. consult.py +17 -8
consult.py CHANGED
@@ -256,20 +256,26 @@ with gr.Blocks() as consult:
256
  with gr.Column(visible=False) as ans5_1:
257
  text5_1 = gr.Textbox(interactive=True)
258
  btn5_1 = gr.Button("提交")
259
- result5_1 = gr.Textbox(label="结果5_1")
 
260
  # 请把audio5_2换成Audio组件
261
  with gr.Column(visible=False) as ans5_2:
262
  audio5_2 = gr.Audio(
263
- label="语音录制", interactive=True
264
  ) # 对应out_prob.squeeze(0).numpy()[0]
265
  btn5_2 = gr.Button("提交")
266
- result5_2 = gr.Textbox(label="结果5_2")
 
267
  # 请把video5_3换成Video组件
268
  with gr.Column(visible=False) as ans5_3:
269
  # score = gr.Textbox(label="得分")
270
- video5_3=gr.Video(sources=["webcam", "upload"],interactive=True,)
271
  btn5_3 = gr.Button("提交")
272
- result5_3 = gr.Textbox(label="结果5_3")
 
 
 
 
273
  title6 = gr.Markdown("# 咨询总结与建议", visible=False)
274
  final_score = gr.Textbox(visible=False, interactive=False)
275
  adv = gr.Textbox(label="", visible=False)
@@ -293,7 +299,12 @@ with gr.Blocks() as consult:
293
  btn4_2.click(speech_score4, inputs=audio4_2, outputs=[result4_21,result4_22,q5])
294
  btn4_3.click(video_score4, inputs=video4_3, outputs=[result4_31,result4_32,q5])
295
  radio12.change(visibility_choice2, radio12, [ans5_1, ans5_2, ans5_3])
296
- btn5_1.click(
 
 
 
 
 
297
  advice,
298
  [
299
  radio1,
@@ -309,5 +320,3 @@ with gr.Blocks() as consult:
309
  ],
310
  [title6, final_score, adv],
311
  )
312
- # btn5_2.click(visibility,outputs=q5)
313
- # btn5_3.click(visibility,outputs=q5)
 
256
  with gr.Column(visible=False) as ans5_1:
257
  text5_1 = gr.Textbox(interactive=True)
258
  btn5_1 = gr.Button("提交")
259
+ result5_11 = gr.Textbox(label="结果5_1")
260
+ result5_12 = gr.Textbox(label="分数结果5_1")
261
  # 请把audio5_2换成Audio组件
262
  with gr.Column(visible=False) as ans5_2:
263
  audio5_2 = gr.Audio(
264
+ label="语音录制", interactive=True, sources=["microphone"],
265
  ) # 对应out_prob.squeeze(0).numpy()[0]
266
  btn5_2 = gr.Button("提交")
267
+ result5_21 = gr.Textbox(label="结果5_2")
268
+ result5_22 = gr.Textbox(label="分数结果5_2")
269
  # 请把video5_3换成Video组件
270
  with gr.Column(visible=False) as ans5_3:
271
  # score = gr.Textbox(label="得分")
272
+ video5_3=gr.Video(sources=["webcam", "upload"],interactive=True,format='mp4',width=500)
273
  btn5_3 = gr.Button("提交")
274
+ result5_31 = gr.Textbox(label="结果5_3")
275
+ result5_32 = gr.Textbox(label="分数结果5_3")
276
+ with gr.Column(visible=False) as summary:
277
+ gr.Markdown("#### 你完成了所有的测验,点击下方按钮生成报告吧~")
278
+ summary_button=gr.Button("生成结论")
279
  title6 = gr.Markdown("# 咨询总结与建议", visible=False)
280
  final_score = gr.Textbox(visible=False, interactive=False)
281
  adv = gr.Textbox(label="", visible=False)
 
299
  btn4_2.click(speech_score4, inputs=audio4_2, outputs=[result4_21,result4_22,q5])
300
  btn4_3.click(video_score4, inputs=video4_3, outputs=[result4_31,result4_32,q5])
301
  radio12.change(visibility_choice2, radio12, [ans5_1, ans5_2, ans5_3])
302
+
303
+ btn5_1.click(text_score4,inputs=text5_1, outputs=[result5_11,result5_12,summary])
304
+ btn5_2.click(speech_score4, inputs=audio5_2, outputs=[result5_21,result5_22,summary])
305
+ btn5_3.click(video_score4, inputs=video5_3, outputs=[result5_31,result5_32,summary])
306
+
307
+ summary_button.click(
308
  advice,
309
  [
310
  radio1,
 
320
  ],
321
  [title6, final_score, adv],
322
  )