|
import gradio as gr |
|
from pydub import AudioSegment |
|
|
|
|
|
def combine_audio(target_audio, mixed_audio): |
|
|
|
target_audio_segment = AudioSegment.from_wav(target_audio.name) |
|
|
|
|
|
mixed_audio_segment = AudioSegment.from_wav(mixed_audio.name) |
|
|
|
|
|
final_audio = mixed_audio_segment + target_audio_segment |
|
|
|
|
|
output_path = "final_output.wav" |
|
final_audio.export(output_path, format="wav") |
|
return output_path |
|
|
|
|
|
interface = gr.Interface( |
|
fn=combine_audio, |
|
inputs=[ |
|
gr.inputs.File(label="目标说话人音频"), |
|
gr.inputs.File(label="混合音频") |
|
], |
|
outputs=gr.outputs.File(label="输出音频"), |
|
live=False |
|
) |
|
|
|
|
|
interface.launch() |
|
|