intersteller2887 commited on
Commit
7954a10
·
verified ·
1 Parent(s): 4a8daec

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +40 -32
app.py CHANGED
@@ -47,54 +47,61 @@ print(sample1_audio_path)
47
 
48
  DIMENSIONS_DATA = [
49
  {
50
- "title": "语义和语用特征",
51
- "audio": sample1_audio_path,
52
  "sub_dims": [
53
- "记忆一致性:人类在短上下文中记忆通常一致,不一致也会尝试自我修正(如提问);机器则可能会出现上下文记忆不一致且无法察觉或修正(如遗忘掉关键信息坚持错误回答)", "逻辑连贯性:人类逻辑自然流畅,允许合理跳跃;机器逻辑转折生硬或自相矛盾(如:突然切换话题无过渡)",
54
- "读音正确性:人类大部分情况下发音正确、自然,会结合语境使用、区分多音字;机器存在不自然的发音错误,且对多音字语境的判断能力有限", "多语言混杂:人类多语言混杂流畅,且带有语境色彩;机器多语言混杂生硬,无语言切换逻辑",
55
- "语言不精确性:人类说话时倾向存在含糊表达:如“差不多”、“应该是吧”,且会出现自我修正的行为;机器的回应通常不存在模糊表达,回答准确、肯定", "填充词使用:人类填充词(如‘嗯’‘那个’)随机且带有思考痕迹;机器填充词规律重复或完全缺失",
56
- "隐喻与语用用意:人类会使用隐喻、反语、委婉来表达多重含义;机器表达直白,仅能字面理解或生硬使用修辞,缺乏语义多样性"
 
 
 
57
  ],
58
- "reference_scores": [5, 5, 5, 0, 5, 5, 0]
59
  },
60
  {
61
- "title": "非生理性副语言特征",
62
- "audio": sample1_audio_path,
63
  "sub_dims": [
64
- "节奏:人类语速随语义起伏,偶尔卡顿或犹豫;机器节奏均匀,几乎无停顿或停顿机械", "语调:人类在表达如疑问、惊讶、强调时,音调会自然上扬或下降;机器语调单一或变化过于规律,不符合语境",
65
- "重读:人类会有意识地加强重要词语,从而突出信息焦点;机器的词语强度一致性强,或出现强调部位异常", "辅助性发声:人类会发出符合语境的非语言声音,如笑声、叹气等;机器的辅助性发声语境错误或机械化,或完全无辅助性发声"
 
 
66
  ],
67
- "reference_scores": [5, 5, 5, 5]
68
  },
69
  {
70
- "title": "生理性副语言特征",
71
- "audio": sample1_audio_path,
72
  "sub_dims": [
73
- "微生理杂音:人类说话存在呼吸声、口水音、气泡音等无意识发声,且自然地穿插在语流节奏当中;机器没有微生理杂音、语音过于干净,或添加不自然杂音",
74
- "发音不稳定性:人类存在一定不规则性(诸如连读、颤音、含糊发音、鼻音等);机器发音过于标准或统一,缺乏个性", "口音:人类存在自然的地区口音或语音特征;机器带口音效果生硬"
 
75
  ],
76
- "reference_scores": [5, 4, 4]
77
  },
78
  {
79
- "title": "机械人格",
80
- "audio": sample1_audio_path,
81
  "sub_dims": [
82
- "谄媚现象:人类会根据语境判断是否同意,有时提出不同意见;机器频繁同意、感谢、道歉,过度认同对方观点,缺乏真实互动感",
83
- "书面化表达:人类表达灵活,;机器回应句式工整、规范,内容过于书面化、用词泛泛"
84
  ],
85
  "reference_scores": [5, 5]
86
  },
87
  {
88
- "title": "情感表达",
89
- "audio": sample1_audio_path,
90
  "sub_dims": [
91
- "语义层面:人类能对悲伤、开心等语境有符合人类的情感反应;机器回应情绪淡漠,或情感词泛泛、脱离语境",
92
- "声学层面:人类音调、音量、节奏等声学特征随情绪动态变化;机器情感语调模式化,或与语境不符"
93
  ],
94
- "reference_scores": [5, 5]
95
  }
96
  ]
97
 
 
98
  DIMENSION_TITLES = [d["title"] for d in DIMENSIONS_DATA]
99
  MAX_SUB_DIMS = max(len(d['sub_dims']) for d in DIMENSIONS_DATA)
100
 
@@ -543,7 +550,7 @@ def submit_question_and_advance(q_idx, d_idx, selections, final_choice, all_resu
543
  return init_q_updates + (all_results, gr.update(value=""))
544
  else:
545
  # 准备完整结果数据
546
- result_str = "### 测试全部完成!\n\n你的提交结果概览:\n"
547
  for res in all_results:
548
  result_str += f"##### 最终判断: **{res['selections'].get('final_choice', '未选择')}**\n"
549
  for dim_title, dim_data in res['selections'].items():
@@ -756,11 +763,11 @@ with gr.Blocks(theme=gr.themes.Soft(), css=".gradio-container {max-width: 960px
756
  }
757
 
758
  with welcome_page:
759
- gr.Markdown("# AI 识破者\n你将听到一系列对话,请判断哪个回应者是 AI")
760
- start_btn = gr.Button("开始挑战", variant="primary")
761
 
762
  with info_page:
763
- gr.Markdown("## 请提供一些基本信息")
764
  username_input = gr.Textbox(label="用户名", placeholder="请输入你的昵称")
765
  age_input = gr.Radio(["18岁以下", "18-25岁", "26-35岁", "36-50岁", "50岁以上"], label="年龄")
766
  gender_input = gr.Radio(["男", "女", "其他"], label="性别")
@@ -770,7 +777,8 @@ with gr.Blocks(theme=gr.themes.Soft(), css=".gradio-container {max-width: 960px
770
  submit_info_btn = gr.Button("提交并开始学习样例", variant="primary", interactive=False)
771
 
772
  with sample_page:
773
-
 
774
  gr.Markdown("## 样例分析\n请选择一个维度进行学习和打分练习。所有维度共用同一个样例音频。")
775
  sample_dimension_selector = gr.Radio(DIMENSION_TITLES, label="选择学习维度", value=DIMENSION_TITLES[0])
776
  with gr.Row():
@@ -801,7 +809,7 @@ with gr.Blocks(theme=gr.themes.Soft(), css=".gradio-container {max-width: 960px
801
  "- 完成所有维度后,请根据整体印象对回应方的身份做出做出“人类”或“机器人”的 **最终判断**。\n"
802
  "- 你可以使用“上一维度”和“下一维度”按钮在5个维度间自由切换和修改分数。")
803
  go_to_test_btn = gr.Button("开始测试", variant="primary")
804
-
805
  with test_page:
806
  gr.Markdown("## 正式测试")
807
  question_progress_text = gr.Markdown()
 
47
 
48
  DIMENSIONS_DATA = [
49
  {
50
+ "title": "Semantic and Pragmatic Features",
51
+ "audio": "sample1_audio_path",
52
  "sub_dims": [
53
+ "Memory Consistency: Human memory in short contexts is usually consistent and self-correcting (e.g., by asking questions); machines may show inconsistent context memory and fail to notice or correct errors (e.g., forgetting key information and persisting in wrong answers).",
54
+ "Logical Coherence: Human logic is naturally coherent and allows reasonable leaps; machine logic is abrupt or self-contradictory (e.g., sudden topic shifts without transitions).",
55
+ "Pronunciation Accuracy: Humans generally pronounce words correctly and naturally, distinguishing polyphonic characters based on context; machines often mispronounce or lack contextual judgment for polyphonic words.",
56
+ "Multilingual Mixing: Humans mix multiple languages fluently and contextually; machines mix languages rigidly, lacking logical language switching.",
57
+ "Linguistic Vagueness: Human speech tends to include vague expressions (e.g., “more or less,” “I guess”) and self-corrections; machine responses are typically precise and assertive.",
58
+ "Filler Word Usage: Human filler words (e.g., 'uh', 'like') appear randomly and show signs of thinking; machine fillers are either repetitive and patterned or completely absent.",
59
+ "Metaphor and Pragmatic Intent: Humans use metaphors, irony, and euphemisms to express layered meanings; machines interpret literally or use rhetorical devices awkwardly, lacking semantic richness."
60
  ],
61
+ "reference_scores": [5, 5, 3, 3, 5, 5, 3]
62
  },
63
  {
64
+ "title": "Non-Physiological Paralinguistic Features",
65
+ "audio": "sample1_audio_path",
66
  "sub_dims": [
67
+ "Rhythm: Human speech rate varies with meaning, occasionally hesitating or pausing; machine rhythm is uniform, with little or mechanical pauses.",
68
+ "Intonation: Humans naturally raise or lower pitch to express questions, surprise, or emphasis; machine intonation is monotonous or overly patterned, mismatching the context.",
69
+ "Emphasis: Humans consciously stress key words to highlight important information; machines have uniform word emphasis or stress incorrect parts.",
70
+ "Auxiliary Vocalizations: Humans produce context-appropriate non-verbal sounds (e.g., laughter, sighs); machine non-verbal sounds are contextually incorrect, mechanical, or absent."
71
  ],
72
+ "reference_scores": [4, 5, 4, 3]
73
  },
74
  {
75
+ "title": "Physiological Paralinguistic Features",
76
+ "audio": "sample1_audio_path",
77
  "sub_dims": [
78
+ "Micro-physiological Noise: Human speech includes unconscious physiological sounds like breathing, saliva, or bubbling, naturally woven into rhythm; machine speech is overly clean or adds unnatural noises.",
79
+ "Pronunciation Instability: Human pronunciation includes irregularities (e.g., linking, tremors, slurring, nasal sounds); machine pronunciation is overly standard and uniform, lacking personality.",
80
+ "Accent: Humans naturally exhibit regional accents or speech traits; machine accents sound forced or unnatural."
81
  ],
82
+ "reference_scores": [3, 3, 4]
83
  },
84
  {
85
+ "title": "Mechanical Persona",
86
+ "audio": "sample1_audio_path",
87
  "sub_dims": [
88
+ "Flattery: Humans assess context to agree or disagree, sometimes offering differing opinions; machines excessively agree, thank, or apologize, over-validating the other party and lacking authentic interaction.",
89
+ "Formalized Expression: Human speech is flexible; machine responses are formally structured, overly written, and use vague wording."
90
  ],
91
  "reference_scores": [5, 5]
92
  },
93
  {
94
+ "title": "Emotional Expression",
95
+ "audio": "sample1_audio_path",
96
  "sub_dims": [
97
+ "Semantic Level: Humans show appropriate emotional responses to contexts like sadness or joy; machines are emotionally flat, or use emotional words vaguely and out of context.",
98
+ "Acoustic Level: Human pitch, volume, and rhythm change dynamically with emotion; machine emotional tone is formulaic or mismatched with the context."
99
  ],
100
+ "reference_scores": [3, 3]
101
  }
102
  ]
103
 
104
+
105
  DIMENSION_TITLES = [d["title"] for d in DIMENSIONS_DATA]
106
  MAX_SUB_DIMS = max(len(d['sub_dims']) for d in DIMENSIONS_DATA)
107
 
 
550
  return init_q_updates + (all_results, gr.update(value=""))
551
  else:
552
  # 准备完整结果数据
553
+ result_str = "### Test Finished!\n\nOverview of the submission:\n"
554
  for res in all_results:
555
  result_str += f"##### 最终判断: **{res['selections'].get('final_choice', '未选择')}**\n"
556
  for dim_title, dim_data in res['selections'].items():
 
763
  }
764
 
765
  with welcome_page:
766
+ gr.Markdown("# AI Detective\nListen to the following conversations. Please determine which respondent is an AI.")
767
+ start_btn = gr.Button("Start", variant="primary")
768
 
769
  with info_page:
770
+ gr.Markdown("## Basic Information")
771
  username_input = gr.Textbox(label="用户名", placeholder="请输入你的昵称")
772
  age_input = gr.Radio(["18岁以下", "18-25岁", "26-35岁", "36-50岁", "50岁以上"], label="年龄")
773
  gender_input = gr.Radio(["男", "女", "其他"], label="性别")
 
777
  submit_info_btn = gr.Button("提交并开始学习样例", variant="primary", interactive=False)
778
 
779
  with sample_page:
780
+
781
+
782
  gr.Markdown("## 样例分析\n请选择一个维度进行学习和打分练习。所有维度共用同一个样例音频。")
783
  sample_dimension_selector = gr.Radio(DIMENSION_TITLES, label="选择学习维度", value=DIMENSION_TITLES[0])
784
  with gr.Row():
 
809
  "- 完成所有维度后,请根据整体印象对回应方的身份做出做出“人类”或“机器人”的 **最终判断**。\n"
810
  "- 你可以使用“上一维度”和“下一维度”按钮在5个维度间自由切换和修改分数。")
811
  go_to_test_btn = gr.Button("开始测试", variant="primary")
812
+
813
  with test_page:
814
  gr.Markdown("## 正式测试")
815
  question_progress_text = gr.Markdown()