qwer5112 commited on
Commit
ce150fc
·
1 Parent(s): 8e0c138

Render survey title with consistent typography

Browse files
Files changed (1) hide show
  1. app.py +20 -5
app.py CHANGED
@@ -147,7 +147,7 @@ RATING_FIELDS = tuple(
147
  DEFAULT_LANGUAGE = "en"
148
  UI_TEXT = {
149
  "en": {
150
- "title": "# 🎧 SCRV2A Human Evaluation",
151
  "intro": f"""
152
  This human evaluation study assesses audio generated for **SCRV2A**.
153
 
@@ -193,7 +193,7 @@ Thank you for participating in this evaluation.
193
  "save_failed": "The response could not be saved: {error}",
194
  },
195
  "zh": {
196
- "title": "# 🎧 SCRV2A 人工评测",
197
  "intro": f"""
198
  本次人工评测用于评价 **SCRV2A** 生成的音频。
199
 
@@ -277,6 +277,12 @@ def progress_markdown(current_index: int, language: Any) -> str:
277
  )
278
 
279
 
 
 
 
 
 
 
280
  def matrix_header_html(label: str, scale: str | None = None) -> str:
281
  """Build the controlled HTML used by one matrix header cell."""
282
 
@@ -782,7 +788,7 @@ def toggle_language(
782
 
783
  return (
784
  new_language,
785
- gr.Markdown(value=interface_text(new_language, "title")),
786
  gr.Markdown(value=interface_text(new_language, "intro")),
787
  gr.Button(value=interface_text(new_language, "language_button")),
788
  *header_updates,
@@ -813,7 +819,14 @@ CSS = """
813
  }
814
  .page-title h1 {
815
  margin-bottom: 4px !important;
 
816
  font-size: clamp(1.45rem, 2.3vw, 2rem) !important;
 
 
 
 
 
 
817
  }
818
  .language-button {
819
  width: min(140px, 100%) !important;
@@ -1029,8 +1042,10 @@ with gr.Blocks(title="V2A Human Evaluation") as demo:
1029
  language_state = gr.State(value=DEFAULT_LANGUAGE)
1030
 
1031
  with gr.Column(elem_classes="page-shell") as survey_page:
1032
- page_title = gr.Markdown(
1033
- interface_text(DEFAULT_LANGUAGE, "title"), elem_classes="page-title"
 
 
1034
  )
1035
  language_button = gr.Button(
1036
  interface_text(DEFAULT_LANGUAGE, "language_button"),
 
147
  DEFAULT_LANGUAGE = "en"
148
  UI_TEXT = {
149
  "en": {
150
+ "title": "🎧 SCRV2A Human Evaluation",
151
  "intro": f"""
152
  This human evaluation study assesses audio generated for **SCRV2A**.
153
 
 
193
  "save_failed": "The response could not be saved: {error}",
194
  },
195
  "zh": {
196
+ "title": "🎧 SCRV2A 人工评测",
197
  "intro": f"""
198
  本次人工评测用于评价 **SCRV2A** 生成的音频。
199
 
 
277
  )
278
 
279
 
280
+ def page_title_html(language: Any) -> str:
281
+ """Build a title without Markdown heading anchors."""
282
+
283
+ return f"<h1>{interface_text(language, 'title')}</h1>"
284
+
285
+
286
  def matrix_header_html(label: str, scale: str | None = None) -> str:
287
  """Build the controlled HTML used by one matrix header cell."""
288
 
 
788
 
789
  return (
790
  new_language,
791
+ gr.HTML(value=page_title_html(new_language)),
792
  gr.Markdown(value=interface_text(new_language, "intro")),
793
  gr.Button(value=interface_text(new_language, "language_button")),
794
  *header_updates,
 
819
  }
820
  .page-title h1 {
821
  margin-bottom: 4px !important;
822
+ font-family: inherit !important;
823
  font-size: clamp(1.45rem, 2.3vw, 2rem) !important;
824
+ font-weight: 700 !important;
825
+ line-height: 1.2;
826
+ letter-spacing: normal;
827
+ }
828
+ .page-title h1 * {
829
+ font: inherit !important;
830
  }
831
  .language-button {
832
  width: min(140px, 100%) !important;
 
1042
  language_state = gr.State(value=DEFAULT_LANGUAGE)
1043
 
1044
  with gr.Column(elem_classes="page-shell") as survey_page:
1045
+ page_title = gr.HTML(
1046
+ page_title_html(DEFAULT_LANGUAGE),
1047
+ apply_default_css=False,
1048
+ elem_classes="page-title",
1049
  )
1050
  language_button = gr.Button(
1051
  interface_text(DEFAULT_LANGUAGE, "language_button"),