next-playground commited on
Commit
948bd40
·
verified ·
1 Parent(s): e96c6e3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -18,7 +18,6 @@ def audio_overlay(audio1, audio2, save_filename):
18
 
19
  overlayed_audio = audio_raw1.overlay(audio_raw2)
20
  save_path = os.path.join("/tmp", save_filename)
21
- print("Task completed. Result file is in: " + save_path)
22
  overlayed_audio.export(save_path, format="mp3")
23
 
24
  # 任务队列和状态存储
@@ -49,11 +48,13 @@ def process_audio_overlay(task_id, audio_url1, audio_url2):
49
  with open("/tmp/" + audio_filename2, 'wb') as f:
50
  f.write(response2.content)
51
 
 
 
52
  # 执行音频合并操作
53
- audio = audio_overlay("/tmp/" + audio_filename1, "/tmp/" + audio_filename2, os.path.join("/tmp", audio_filename1 + "_with_" + audio_filename2 + "_overlayed.mp3"))
54
 
55
  # 提供文件的永久直链
56
- result_audio_url = "/download/" + audio_filename1 + "_with_" + audio_filename2 + "_overlayed.mp3"
57
 
58
  # 更新任务状态
59
  tasks[task_id] = {
 
18
 
19
  overlayed_audio = audio_raw1.overlay(audio_raw2)
20
  save_path = os.path.join("/tmp", save_filename)
 
21
  overlayed_audio.export(save_path, format="mp3")
22
 
23
  # 任务队列和状态存储
 
48
  with open("/tmp/" + audio_filename2, 'wb') as f:
49
  f.write(response2.content)
50
 
51
+ file_id = str(uuid.uuid4())
52
+
53
  # 执行音频合并操作
54
+ audio = audio_overlay("/tmp/" + audio_filename1, "/tmp/" + audio_filename2, os.path.join("/tmp", file_id + ".mp3"))
55
 
56
  # 提供文件的永久直链
57
+ result_audio_url = "/download/" + file_id + ".mp3"
58
 
59
  # 更新任务状态
60
  tasks[task_id] = {