DeepLearning101 commited on
Commit
af25a31
·
verified ·
1 Parent(s): 7094a64

Update app.py

Browse files

Traceback (most recent call last):
File "/home/user/app/app.py", line 26, in <module>
audio_input = gr.Audio(source="upload", type="filepath", label="上載你的音頻")
File "/usr/local/lib/python3.10/site-packages/gradio/component_meta.py", line 159, in wrapper
return fn(self, **kwargs)
TypeError: Audio.__init__() got an unexpected keyword argument 'source'

移除source和type參數:最新版本的Gradio 可能不再需要或支援這些參數。如果是要上傳音訊文件,通常只需要簡單地使用gr.Audio()。

Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -23,7 +23,8 @@ def transcribe(audio_file):
23
  with gr.Blocks(css=".container { max-width: 800px; margin: auto; } .gradio-app { background-color: #f0f0f0; } button { background-color: #4CAF50; color: white; }") as demo:
24
  gr.Markdown("ASR 語音語料辨識修正工具")
25
  with gr.Row():
26
- audio_input = gr.Audio(source="upload", type="filepath", label="上載你的音頻")
 
27
  submit_button = gr.Button("語音識別")
28
  output_text = gr.TextArea(label="識別結果")
29
  download_link = gr.File(label="下載轉錄文件")
 
23
  with gr.Blocks(css=".container { max-width: 800px; margin: auto; } .gradio-app { background-color: #f0f0f0; } button { background-color: #4CAF50; color: white; }") as demo:
24
  gr.Markdown("ASR 語音語料辨識修正工具")
25
  with gr.Row():
26
+ # 修改了 Audio 組件的宣告方式
27
+ audio_input = gr.Audio(label="上載你的音頻", type="filepath")
28
  submit_button = gr.Button("語音識別")
29
  output_text = gr.TextArea(label="識別結果")
30
  download_link = gr.File(label="下載轉錄文件")