Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -25,7 +25,7 @@ if not os.path.exists(model_dir):
|
|
| 25 |
local_dir=model_dir,
|
| 26 |
local_dir_use_symlinks=False
|
| 27 |
)
|
| 28 |
-
|
| 29 |
# 1. 加载模型(只加载一次)
|
| 30 |
model = FireRedAsr.from_pretrained(
|
| 31 |
"aed",
|
|
@@ -82,9 +82,9 @@ with gr.Blocks() as demo:
|
|
| 82 |
|
| 83 |
with gr.Tab("🎤 实时麦克风录音"):
|
| 84 |
gr.Markdown("点击录音按钮开始说话,识别结果会实时显示。")
|
| 85 |
-
mic_audio = gr.Audio(
|
| 86 |
-
|
| 87 |
-
mic_audio.
|
| 88 |
|
| 89 |
with gr.Tab("📁 文件上传识别"):
|
| 90 |
gr.Markdown("上传音频文件,点击按钮进行识别。")
|
|
|
|
| 25 |
local_dir=model_dir,
|
| 26 |
local_dir_use_symlinks=False
|
| 27 |
)
|
| 28 |
+
|
| 29 |
# 1. 加载模型(只加载一次)
|
| 30 |
model = FireRedAsr.from_pretrained(
|
| 31 |
"aed",
|
|
|
|
| 82 |
|
| 83 |
with gr.Tab("🎤 实时麦克风录音"):
|
| 84 |
gr.Markdown("点击录音按钮开始说话,识别结果会实时显示。")
|
| 85 |
+
mic_audio = gr.Audio(type="filepath", label="实时录音", streaming=True)
|
| 86 |
+
output_text = gr.Textbox()
|
| 87 |
+
mic_audio.stream(fn=transcribe_fn, inputs=mic_audio, outputs=output_text)
|
| 88 |
|
| 89 |
with gr.Tab("📁 文件上传识别"):
|
| 90 |
gr.Markdown("上传音频文件,点击按钮进行识别。")
|