import gradio as gr from pydub import AudioSegment def convert(input_file): sound = AudioSegment.from_mp3(input_file.name) sound.export("output.opus", format="opus") return "output.opus" iface = gr.Interface(fn=convert, inputs=gr.File(label="Upload MP3"), outputs=gr.File(label="Download Opus")) iface.launch()