WizardForest commited on
Commit
28da944
·
verified ·
1 Parent(s): 0c07274

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -11
app.py CHANGED
@@ -28,7 +28,8 @@ def load_model():
28
  model=model,
29
  tokenizer=processor.tokenizer,
30
  feature_extractor=processor.feature_extractor,
31
- chunk_length_s=0
 
32
  )
33
 
34
  return f"✅ 模型載入成功!使用設備: {device}"
@@ -158,21 +159,15 @@ with gr.Blocks(title="語音辨識系統", theme=gr.themes.Soft()) as demo:
158
  with gr.Row():
159
  with gr.Column(scale=1):
160
  # 音訊輸入區域
161
- gr.Markdown("### 📂 音訊輸入(wav)")
162
 
163
  with gr.Tab("檔案上傳"):
164
  audio_file = gr.Audio(
 
165
  label="上傳音訊檔案",
166
- type="filepath",
167
- format="wav"
168
  )
169
 
170
- with gr.Tab("即時錄音"):
171
- audio_mic = gr.Audio(
172
- label="點擊開始錄音",
173
- type="numpy",
174
- format="wav"
175
- )
176
 
177
  # 控制按鈕
178
  with gr.Row():
@@ -215,7 +210,7 @@ with gr.Blocks(title="語音辨識系統", theme=gr.themes.Soft()) as demo:
215
 
216
  transcribe_btn.click(
217
  fn=transcribe_wrapper,
218
- inputs=[audio_file, audio_mic],
219
  outputs=[status_output, pure_text_output, srt_output]
220
  )
221
 
 
28
  model=model,
29
  tokenizer=processor.tokenizer,
30
  feature_extractor=processor.feature_extractor,
31
+ chunk_length_s=0,
32
+ device=device
33
  )
34
 
35
  return f"✅ 模型載入成功!使用設備: {device}"
 
159
  with gr.Row():
160
  with gr.Column(scale=1):
161
  # 音訊輸入區域
162
+ gr.Markdown("### 📂 音訊輸入")
163
 
164
  with gr.Tab("檔案上傳"):
165
  audio_file = gr.Audio(
166
+ sources=["upload"],
167
  label="上傳音訊檔案",
168
+ type="filepath"
 
169
  )
170
 
 
 
 
 
 
 
171
 
172
  # 控制按鈕
173
  with gr.Row():
 
210
 
211
  transcribe_btn.click(
212
  fn=transcribe_wrapper,
213
+ inputs=[audio_file],
214
  outputs=[status_output, pure_text_output, srt_output]
215
  )
216