intersteller2887 commited on
Commit
62a986e
·
verified ·
1 Parent(s): 0f626b8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -2
app.py CHANGED
@@ -96,8 +96,10 @@ DIMENSIONS_DATA = [
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
 
 
101
  # ==============================================================================
102
  # Backend Function Definitions
103
  # ==============================================================================
@@ -826,7 +828,7 @@ with gr.Blocks(theme=gr.themes.Soft(), css=".gradio-container {max-width: 960px
826
  username_input = gr.Textbox(label="用户名", placeholder="请输入你的昵称")
827
  age_input = gr.Radio(["18岁以下", "18-25岁", "26-35岁", "36-50岁", "50岁以上"], label="年龄")
828
  gender_input = gr.Radio(["男", "女", "其他"], label="性别")
829
- education_input = gr.Radio(["高中及以下", "本科", "硕士", "博士", "其他(请注明)"], label="学历")
830
  education_other_input = gr.Textbox(label="请填写你的学历", visible=False, interactive=False)
831
  ai_experience_input = gr.Radio(["从未使用过", "偶尔接触(如看别人用)", "使用过几次,了解基本功能", "经常使用,有一定操作经验", "非常熟悉,深入使用过多个 AI 工具"], label="对 AI 工具的熟悉程度")
832
  submit_info_btn = gr.Button("提交并开始学习样例", variant="primary", interactive=False)
@@ -843,7 +845,7 @@ with gr.Blocks(theme=gr.themes.Soft(), css=".gradio-container {max-width: 960px
843
  gr.Markdown("#### 请为以下特征打分 (0-5分。0-特征无体现;1-机器;3-特征无偏向;5-人类)")
844
  sample_sliders = [gr.Slider(minimum=0, maximum=5, step=1, label=f"Sub-dim {i+1}", visible=False, interactive=True) for i in range(MAX_SUB_DIMS)]
845
  with gr.Column(visible=False) as reference_view:
846
- gr.Markdown("### 参考答案解析 (1-5分。1对应机器,5对应人类)")
847
  reference_sliders = [gr.Slider(minimum=0, maximum=5, step=1, label=f"Sub-dim {i+1}", visible=False, interactive=False) for i in range(MAX_SUB_DIMS)]
848
  with gr.Row():
849
  reference_btn = gr.Button("参考")
@@ -873,7 +875,24 @@ with gr.Blocks(theme=gr.themes.Soft(), css=".gradio-container {max-width: 960px
873
  test_dimension_title = gr.Markdown()
874
  test_audio = gr.Audio(label="测试音频")
875
  gr.Markdown("--- \n ### 请为对话中的回应者(非发起者)针对以下特征打分 (0-5分。0-特征无体现;1-机器;3-特征无偏向;5-人类)")
 
 
876
  test_sliders = [gr.Slider(minimum=0, maximum=5, step=1, label=f"Sub-dim {i+1}", visible=False, interactive=True) for i in range(MAX_SUB_DIMS)]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
877
  with gr.Row():
878
  prev_dim_btn = gr.Button("上一维度")
879
  next_dim_btn = gr.Button("下一维度", variant="primary")
 
96
  ]
97
 
98
  DIMENSION_TITLES = [d["title"] for d in DIMENSIONS_DATA]
99
+ SPECIAL_KEYWORDS = ["多语言混杂", "隐喻与语用用意", "辅助性发声"]
100
  MAX_SUB_DIMS = max(len(d['sub_dims']) for d in DIMENSIONS_DATA)
101
 
102
+
103
  # ==============================================================================
104
  # Backend Function Definitions
105
  # ==============================================================================
 
828
  username_input = gr.Textbox(label="用户名", placeholder="请输入你的昵称")
829
  age_input = gr.Radio(["18岁以下", "18-25岁", "26-35岁", "36-50岁", "50岁以上"], label="年龄")
830
  gender_input = gr.Radio(["男", "女", "其他"], label="性别")
831
+ education_input = gr.Radio(["高中及以下", "本科", "硕士", "博士", "其他"], label="学历")
832
  education_other_input = gr.Textbox(label="请填写你的学历", visible=False, interactive=False)
833
  ai_experience_input = gr.Radio(["从未使用过", "偶尔接触(如看别人用)", "使用过几次,了解基本功能", "经常使用,有一定操作经验", "非常熟悉,深入使用过多个 AI 工具"], label="对 AI 工具的熟悉程度")
834
  submit_info_btn = gr.Button("提交并开始学习样例", variant="primary", interactive=False)
 
845
  gr.Markdown("#### 请为以下特征打分 (0-5分。0-特征无体现;1-机器;3-特征无偏向;5-人类)")
846
  sample_sliders = [gr.Slider(minimum=0, maximum=5, step=1, label=f"Sub-dim {i+1}", visible=False, interactive=True) for i in range(MAX_SUB_DIMS)]
847
  with gr.Column(visible=False) as reference_view:
848
+ gr.Markdown("### 参考答案解析")
849
  reference_sliders = [gr.Slider(minimum=0, maximum=5, step=1, label=f"Sub-dim {i+1}", visible=False, interactive=False) for i in range(MAX_SUB_DIMS)]
850
  with gr.Row():
851
  reference_btn = gr.Button("参考")
 
875
  test_dimension_title = gr.Markdown()
876
  test_audio = gr.Audio(label="测试音频")
877
  gr.Markdown("--- \n ### 请为对话中的回应者(非发起者)针对以下特征打分 (0-5分。0-特征无体现;1-机器;3-特征无偏向;5-人类)")
878
+
879
+
880
  test_sliders = [gr.Slider(minimum=0, maximum=5, step=1, label=f"Sub-dim {i+1}", visible=False, interactive=True) for i in range(MAX_SUB_DIMS)]
881
+ for i, titles in enumerate(DIMENSION_TITLES):
882
+ # test_sliders[i].visible = True
883
+ # test_sliders[i].label = desc
884
+ # test_sliders[i].interactive = True
885
+ # test_sliders[i].value = None # 清除旧值
886
+
887
+ if any(keyword in titles for keyword in SPECIAL_KEYWORDS):
888
+ test_sliders[i].minimum = 1
889
+ # else:
890
+ # test_sliders[i].minimum = 0
891
+
892
+
893
+ # # 隐藏多余滑动条
894
+ # for j in range(len(sub_dims), MAX_SUB_DIMS):
895
+ # test_sliders[j].visible = False
896
  with gr.Row():
897
  prev_dim_btn = gr.Button("上一维度")
898
  next_dim_btn = gr.Button("下一维度", variant="primary")