tbdavid2019 commited on
Commit
d6f879c
·
1 Parent(s): ef74762

之前的 mix_audio() 只回傳了 text 和 file,沒有 audio 的值,導致錯誤

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -30,7 +30,7 @@ def mix_audio(podcast_file, bgm_file, bgm_volume, loop, fade_in_out, fade_durati
30
  output_file = "mixed_podcast.mp3"
31
  mixed.export(output_file, format="mp3")
32
 
33
- return "混音完成!點擊下載", output_file
34
 
35
  # 建立 Gradio 介面
36
  with gr.Blocks() as app:
@@ -51,6 +51,8 @@ with gr.Blocks() as app:
51
  audio_output = gr.Audio(label="🎧 預覽混音結果", format="mp3", interactive=False, autoplay=False)
52
  download_output = gr.File(label="⬇️ 下載混音 MP3")
53
 
 
 
54
  process_button.click(
55
  fn=mix_audio,
56
  inputs=[podcast_input, bgm_input, bgm_volume, loop_option, fade_option, fade_duration],
 
30
  output_file = "mixed_podcast.mp3"
31
  mixed.export(output_file, format="mp3")
32
 
33
+ return "混音完成!點擊下載", output_file, output_file # 第三個值是給 gr.Audio 用的
34
 
35
  # 建立 Gradio 介面
36
  with gr.Blocks() as app:
 
51
  audio_output = gr.Audio(label="🎧 預覽混音結果", format="mp3", interactive=False, autoplay=False)
52
  download_output = gr.File(label="⬇️ 下載混音 MP3")
53
 
54
+
55
+
56
  process_button.click(
57
  fn=mix_audio,
58
  inputs=[podcast_input, bgm_input, bgm_volume, loop_option, fade_option, fade_duration],