Spaces:
Running
on
Zero
Running
on
Zero
tomxxie
commited on
Commit
·
25ad8b4
1
Parent(s):
7580011
适配为纯英文版本
Browse files
app.py
CHANGED
@@ -45,11 +45,11 @@ custom_css = """
|
|
45 |
TASK_PROMPT_MAPPING = {
|
46 |
"ASR (Automatic Speech Recognition)": "执行语音识别任务,将音频转换为文字。",
|
47 |
"SRWT (Speech Recognition with Timestamps)": "请转录音频内容,并为每个英文词汇及其对应的中文翻译标注出精确到0.1秒的起止时间,时间范围用<>括起来。",
|
48 |
-
"VED (Vocal Event Detection)(
|
49 |
-
"SER (Speech Emotion Recognition)(
|
50 |
-
"SSR (Speaking Style Recognition)(
|
51 |
-
"SGC (Speaker Gender Classification)(
|
52 |
-
"SAP (Speaker Age Prediction)(
|
53 |
"STTC (Speech to Text Chat)": "首先将语音转录为文字,然后对语音内容进行回复,转录和文字之间使用<开始回答>分割。"
|
54 |
}
|
55 |
|
@@ -171,29 +171,29 @@ with gr.Blocks(css=custom_css) as demo:
|
|
171 |
# 添加音频输入和任务选择
|
172 |
with gr.Row():
|
173 |
with gr.Column(scale=1):
|
174 |
-
audio_input = gr.Audio(label="
|
175 |
with gr.Column(scale=1, min_width=300): # 给输出框设置最小宽度,确保等高对齐
|
176 |
-
output_text = gr.Textbox(label="
|
177 |
|
178 |
# 添加任务选择和自定义输入框
|
179 |
with gr.Row():
|
180 |
task_dropdown = gr.Dropdown(
|
181 |
-
label="
|
182 |
-
choices=list(TASK_PROMPT_MAPPING.keys()) + ["
|
183 |
value="ASR (Automatic Speech Recognition)"
|
184 |
)
|
185 |
-
custom_prompt_input = gr.Textbox(label="
|
186 |
|
187 |
# 添加按钮(下载按钮在左边,开始处理按钮在右边)
|
188 |
with gr.Row():
|
189 |
-
download_button = gr.DownloadButton("
|
190 |
-
submit_button = gr.Button("
|
191 |
|
192 |
# 添加确认组件
|
193 |
with gr.Row(visible=False) as confirmation_row:
|
194 |
-
gr.Markdown("
|
195 |
confirmation_buttons = gr.Radio(
|
196 |
-
choices=["
|
197 |
label="",
|
198 |
interactive=True,
|
199 |
container=False,
|
|
|
45 |
TASK_PROMPT_MAPPING = {
|
46 |
"ASR (Automatic Speech Recognition)": "执行语音识别任务,将音频转换为文字。",
|
47 |
"SRWT (Speech Recognition with Timestamps)": "请转录音频内容,并为每个英文词汇及其对应的中文翻译标注出精确到0.1秒的起止时间,时间范围用<>括起来。",
|
48 |
+
"VED (Vocal Event Detection)(Categories:laugh,cough,cry,screaming,sigh,throat clearing,sneeze,other)": "请将音频转录为文字记录,并在记录末尾标注<音频事件>标签,音频事件共8种:laugh,cough,cry,screaming,sigh,throat clearing,sneeze,other。",
|
49 |
+
"SER (Speech Emotion Recognition)(Categories:sad,anger,neutral,happy,surprise,fear,disgust,和other)": "请将音频内容转录成文字记录,并在记录末尾标注<情感>标签,情感共8种:sad,anger,neutral,happy,surprise,fear,disgust,和other。",
|
50 |
+
"SSR (Speaking Style Recognition)(Categories:新闻科普,恐怖故事,童话故事,客服,诗歌散文,有声书,日常口语,其他)": "请将音频内容进行文字转录,并在最后添加<风格>标签,标签共8种:新闻科普、恐怖故事、童话故事、客服、诗歌散文、有声书、日常口语、其他。",
|
51 |
+
"SGC (Speaker Gender Classification)(Categories:female,male)": "请将音频转录为文本,并在文本结尾处标注<性别>标签,性别为female或male。",
|
52 |
+
"SAP (Speaker Age Prediction)(Categories:child、adult和old)": "请将音频转录为文本,并在文本结尾处标注<年龄>标签,年龄划分为child、adult和old三种。",
|
53 |
"STTC (Speech to Text Chat)": "首先将语音转录为文字,然后对语音内容进行回复,转录和文字之间使用<开始回答>分割。"
|
54 |
}
|
55 |
|
|
|
171 |
# 添加音频输入和任务选择
|
172 |
with gr.Row():
|
173 |
with gr.Column(scale=1):
|
174 |
+
audio_input = gr.Audio(label="Record", type="filepath")
|
175 |
with gr.Column(scale=1, min_width=300): # 给输出框设置最小宽度,确保等高对齐
|
176 |
+
output_text = gr.Textbox(label=" Output", lines=8, placeholder="The generated result will be displayed here...", interactive=False)
|
177 |
|
178 |
# 添加任务选择和自定义输入框
|
179 |
with gr.Row():
|
180 |
task_dropdown = gr.Dropdown(
|
181 |
+
label="Task",
|
182 |
+
choices=list(TASK_PROMPT_MAPPING.keys()) + ["Custom Input Text"], # 新增选项
|
183 |
value="ASR (Automatic Speech Recognition)"
|
184 |
)
|
185 |
+
custom_prompt_input = gr.Textbox(label="Custom Task Prompt", placeholder="Please enter a custom task prompt...", visible=False) # 新增文本输入框
|
186 |
|
187 |
# 添加按钮(下载按钮在左边,开始处理按钮在右边)
|
188 |
with gr.Row():
|
189 |
+
download_button = gr.DownloadButton("Download Recording", variant="secondary", elem_classes=["button-height", "download-button"])
|
190 |
+
submit_button = gr.Button("Start to Process", variant="primary", elem_classes=["button-height", "submit-button"])
|
191 |
|
192 |
# 添加确认组件
|
193 |
with gr.Row(visible=False) as confirmation_row:
|
194 |
+
gr.Markdown("Please determine whether the result is correct:")
|
195 |
confirmation_buttons = gr.Radio(
|
196 |
+
choices=["Correct", "Incorrect"],
|
197 |
label="",
|
198 |
interactive=True,
|
199 |
container=False,
|