Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -17,7 +17,8 @@ def audio_overlay(audio1, audio2, save_filename):
|
|
| 17 |
audio_raw2 = audio_raw2[:min_length]
|
| 18 |
|
| 19 |
overlayed_audio = audio_raw1.overlay(audio_raw2)
|
| 20 |
-
|
|
|
|
| 21 |
|
| 22 |
# 任务队列和状态存储
|
| 23 |
tasks = {}
|
|
@@ -48,10 +49,10 @@ def process_audio_overlay(task_id, audio_url1, audio_url2):
|
|
| 48 |
f.write(response2.content)
|
| 49 |
|
| 50 |
# 执行音频合并操作
|
| 51 |
-
audio = audio_overlay("/tmp/" + audio_filename1, "/tmp/" + audio_filename2, audio_filename1 + "_with_" + audio_filename2 + "_overlayed.mp3")
|
| 52 |
|
| 53 |
# 提供文件的永久直链
|
| 54 |
-
result_audio_url = "/download/" + audio_filename1 + "_with_" + audio_filename2 + "_overlayed.mp3"
|
| 55 |
|
| 56 |
# 更新任务状态
|
| 57 |
tasks[task_id] = {
|
|
|
|
| 17 |
audio_raw2 = audio_raw2[:min_length]
|
| 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 |
# 任务队列和状态存储
|
| 24 |
tasks = {}
|
|
|
|
| 49 |
f.write(response2.content)
|
| 50 |
|
| 51 |
# 执行音频合并操作
|
| 52 |
+
audio = audio_overlay("/tmp/" + audio_filename1, "/tmp/" + audio_filename2, os.path.join("/tmp", os.path.join("/tmp", audio_filename1 + "_with_" + audio_filename2 + "_overlayed.mp3")))
|
| 53 |
|
| 54 |
# 提供文件的永久直链
|
| 55 |
+
result_audio_url = "/download/" + os.path.join("/tmp", os.path.join("/tmp", audio_filename1 + "_with_" + audio_filename2 + "_overlayed.mp3"))
|
| 56 |
|
| 57 |
# 更新任务状态
|
| 58 |
tasks[task_id] = {
|