ddsp-demo / app.py
pdjdev's picture
app.py update
1ded5ed
raw
history blame
545 Bytes
import gradio as gr
from huggingface_hub import hf_hub_file_upload
from pydub import AudioSegment
def convert_to_opus(file):
# mp3 νŒŒμΌμ„ μ½μ–΄λ“€μž…λ‹ˆλ‹€.
audio = AudioSegment.from_file(file.name)
# opus 파일둜 λ³€ν™˜ν•©λ‹ˆλ‹€.
opus_file = file.name.replace(".mp3", ".opus")
audio.export(opus_file, format="opus")
# λ³€ν™˜λœ opus νŒŒμΌμ„ Hugging Face Spaces에 μ—…λ‘œλ“œν•©λ‹ˆλ‹€.
url = hf_hub_file_upload(opus_file)
return url
iface = gr.Interface(convert_to_opus, "file", "file")
iface.launch()