Choultion-Rudas commited on
Commit
808bca3
·
verified ·
1 Parent(s): 91216fc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -18
app.py CHANGED
@@ -143,25 +143,13 @@ def model_inference(
143
  if output_format == "原始富文本":
144
  return raw_text
145
  elif output_format == "纯净文本":
146
- return " ".join(re.sub(r"<\|[^>]*>", "", raw_text).split())
147
  else:
148
- return format_str_v3(raw_text)
149
 
150
 
151
- html_intro = """
152
- <div style="text-align: center; font-family: var(--font-sans);">
153
- <h1 style="font-size: 28px;">SenseVoice-Small 语音识别</h1>
154
- <p>SenseVoice 是具有音频理解能力的音频基础模型,包括语音识别(ASR)、语种识别(LID)、语音情感识别(SER)和声学事件分类(AEC)或声学事件检测(AED)。</p>
155
- <p style="font-size: small; color: #888;">支持 MP3, WAV, FLAC, M4A 等常见音频格式。</p>
156
- </div>
157
- """
158
-
159
- custom_css = """
160
- body, .gradio-container {
161
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
162
- }
163
- """
164
-
165
  lang_options = [
166
  ("自动检测", "auto"),
167
  ("中文", "zh"),
@@ -172,7 +160,7 @@ lang_options = [
172
  ("无语音", "nospeech"),
173
  ]
174
 
175
- with gr.Blocks(theme=gr.themes.Soft(), css=custom_css) as demo:
176
  gr.HTML(html_intro)
177
  with gr.Row():
178
  with gr.Column(scale=2):
@@ -194,7 +182,7 @@ with gr.Blocks(theme=gr.themes.Soft(), css=custom_css) as demo:
194
  ban_emo_unk_checkbox = gr.Checkbox(value=False, label="强制情感分类")
195
  fn_button = gr.Button("开始识别", variant="primary")
196
  with gr.Column(scale=3):
197
- text_outputs = gr.Textbox(label="识别结果", lines=20)
198
  fn_button.click(
199
  fn=model_inference,
200
  inputs=[
 
143
  if output_format == "原始富文本":
144
  return raw_text
145
  elif output_format == "纯净文本":
146
+ return add_spacing(" ".join(re.sub(r"<\|[^>]*>", "", raw_text).split()))
147
  else:
148
+ return add_spacing(format_str_v3(raw_text))
149
 
150
 
151
+ html_intro = """<div style="text-align: center; font-family: var(--font-sans);"><h1 style="font-size: 28px;">SenseVoice-Small 语音识别</h1><p>SenseVoice 是具有音频理解能力的音频基础模型,包括语音识别(ASR)、语种识别(LID)、语音情感识别(SER)和声学事件分类(AEC)或声学事件检测(AED)。</p><p style="font-size: small; color: #888;">支持 MP3, WAV, FLAC, M4A 等常见音频格式。</p></div>"""
152
+ custom_css = "body, .gradio-container {font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;}"
 
 
 
 
 
 
 
 
 
 
 
 
153
  lang_options = [
154
  ("自动检测", "auto"),
155
  ("中文", "zh"),
 
160
  ("无语音", "nospeech"),
161
  ]
162
 
163
+ with gr.Blocks(theme=gr.themes.Glass(), css=custom_css) as demo:
164
  gr.HTML(html_intro)
165
  with gr.Row():
166
  with gr.Column(scale=2):
 
182
  ban_emo_unk_checkbox = gr.Checkbox(value=False, label="强制情感分类")
183
  fn_button = gr.Button("开始识别", variant="primary")
184
  with gr.Column(scale=3):
185
+ text_outputs = gr.Textbox(label="识别结果", lines=20, height=520)
186
  fn_button.click(
187
  fn=model_inference,
188
  inputs=[