HappyColor commited on
Commit
61ade44
·
verified ·
1 Parent(s): 441dcc1

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +25 -12
app.py CHANGED
@@ -50,15 +50,15 @@ RUBRIC = """
50
 
51
  例如:音频里有说话、音乐和狗叫,描述只写了 “a dog is barking.” 如果这句是对的,打 5 分。没写到的说话和音乐不影响分数。
52
 
53
- 忽略文笔。同一页上有两段描述,请分别打分,不要比较哪一段写得更全。不用写理由。
54
  """
55
 
56
  ASPECT_GUIDE = """
57
  ### 六个语音 aspect
58
 
59
- 请选出回答这个问题所**必须**从语音中知道的信息。只选必要的,能少选就少选。不需要听音频,也不需要真的把问题答出来。选项不标明正确答案。
60
 
61
- 例如:问题只问说话人具体说了什么,通常只需要 1。问题如果问年龄和情绪,需要 6 和 3。不要把所有沾边的方面都选上。
62
  """
63
 
64
 
@@ -99,16 +99,15 @@ def _intro() -> str:
99
  return f"""
100
  # 语音感知人工评测
101
 
102
- 这个评测有两部分,请一次做完。问题和描述是英文。
103
 
104
  **第一部分:描述是否符合音频**({STUDY.n_desc} 题)
105
- 每题听一段音频,并同时看到两段描述。请分别判断每段描述里写出的内容是否符合音频。两段描述的左右顺序是随机的。只打分,不用写理由。
106
- 共 {STUDY.n_desc} 段音频,总长约 {minutes:.0f} 分钟,每段听一遍。
107
 
108
  **第二部分:回答问题需要哪些语音信息**({STUDY.n_aspect} 题)
109
- 只看文字问题和选项。请选择要回答该问题,必须知道语音的哪些 aspect。
110
 
111
- 开始前请填写姓名。结果会按这个名字保存。用同一个姓名可以继续未完成的进度。
112
  """
113
 
114
 
@@ -182,7 +181,7 @@ def view(state: Optional[Dict[str, Any]], message: str = "", kind: str = "error"
182
  elif phase == "done":
183
  payload["done_text"] = (
184
  f"感谢你完成评测。结果已经记在「{html.escape(str(state.get('rater_id') or ''))}」名下。"
185
- "可以下载自己的答卷;请不要把答卷转给其他被试。"
186
  )
187
  payload["done_file"] = gr.update(visible=True, value=state.get("download"))
188
  return payload
@@ -309,7 +308,7 @@ def build_demo() -> gr.Blocks:
309
  desc_progress = gr.Markdown()
310
  gr.Markdown(
311
  "请听完音频,再给两段描述分别打分。"
312
- "**不要因为描述短或有遗漏而扣分。** 左右顺序是随机的。"
313
  )
314
  desc_audio = gr.Audio(label="原始音频", interactive=False, type="filepath")
315
  with gr.Row():
@@ -330,8 +329,12 @@ def build_demo() -> gr.Blocks:
330
  with gr.Accordion("每个 aspect 是什么", open=True):
331
  gr.Markdown(_catalog())
332
  aspect_query = gr.Textbox(label="问题", lines=3, interactive=False)
333
- aspect_choices = gr.Textbox(label="选项(不标明正确答案)", lines=6, interactive=False)
334
- aspect_select = gr.CheckboxGroup(choices=ASPECT_CHOICES, label="回答这个问题需要哪些 aspect")
 
 
 
 
335
  with gr.Row():
336
  aspect_prev = gr.Button("上一题")
337
  aspect_next = gr.Button("下一题", variant="primary")
@@ -417,6 +420,16 @@ PAGE_CSS = """
417
  .gradio-container, .gradio-container * {
418
  font-family: "Times New Roman", Times, serif !important;
419
  }
 
 
 
 
 
 
 
 
 
 
420
  """
421
 
422
 
 
50
 
51
  例如:音频里有说话、音乐和狗叫,描述只写了 “a dog is barking.” 如果这句是对的,打 5 分。没写到的说话和音乐不影响分数。
52
 
53
+ 忽略文笔。同一页上有两段描述,请分别打分,不要比较哪一段写得更全。
54
  """
55
 
56
  ASPECT_GUIDE = """
57
  ### 六个语音 aspect
58
 
59
+ 请选出回答这个问题所**必须**从语音中知道的信息。只选必要的,能少选就少选。
60
 
61
+ 例如:问题只问说话人具体说了什么,通常只需要 1。问题如果问年龄和情绪,需要 6 和 3。
62
  """
63
 
64
 
 
99
  return f"""
100
  # 语音感知人工评测
101
 
102
+ 评测包含两部分。
103
 
104
  **第一部分:描述是否符合音频**({STUDY.n_desc} 题)
105
+ 每题听一段音频,并同时看到两段描述。请分别判断每段描述里写出的内容是否符合音频。
 
106
 
107
  **第二部分:回答问题需要哪些语音信息**({STUDY.n_aspect} 题)
108
+ 只看文字问题和选项。请选择要回答该问题,必须知道语音哪些角度的信息。
109
 
110
+ 开始前请填写姓名。用同一个姓名可以继续未完成的进度。
111
  """
112
 
113
 
 
181
  elif phase == "done":
182
  payload["done_text"] = (
183
  f"感谢你完成评测。结果已经记在「{html.escape(str(state.get('rater_id') or ''))}」名下。"
184
+ "可以下载自己的答卷。"
185
  )
186
  payload["done_file"] = gr.update(visible=True, value=state.get("download"))
187
  return payload
 
308
  desc_progress = gr.Markdown()
309
  gr.Markdown(
310
  "请听完音频,再给两段描述分别打分。"
311
+ "**需要判断描述是否准确,而不是描述是否全面。不要因为描述短或有遗漏而扣分。**"
312
  )
313
  desc_audio = gr.Audio(label="原始音频", interactive=False, type="filepath")
314
  with gr.Row():
 
329
  with gr.Accordion("每个 aspect 是什么", open=True):
330
  gr.Markdown(_catalog())
331
  aspect_query = gr.Textbox(label="问题", lines=3, interactive=False)
332
+ aspect_choices = gr.Textbox(label="选项", lines=6, interactive=False)
333
+ aspect_select = gr.CheckboxGroup(
334
+ choices=ASPECT_CHOICES,
335
+ label="回答这个问题需要哪些 aspect",
336
+ elem_id="aspect-select",
337
+ )
338
  with gr.Row():
339
  aspect_prev = gr.Button("上一题")
340
  aspect_next = gr.Button("下一题", variant="primary")
 
420
  .gradio-container, .gradio-container * {
421
  font-family: "Times New Roman", Times, serif !important;
422
  }
423
+ #aspect-select .wrap {
424
+ flex-direction: column !important;
425
+ flex-wrap: nowrap !important;
426
+ align-items: stretch !important;
427
+ }
428
+ #aspect-select .wrap > label {
429
+ width: 100% !important;
430
+ box-sizing: border-box !important;
431
+ white-space: normal !important;
432
+ }
433
  """
434
 
435