Update app.py
Browse files
app.py
CHANGED
|
@@ -1,19 +1,10 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
from huggingface_hub import hf_hub_file_upload
|
| 3 |
from pydub import AudioSegment
|
| 4 |
|
| 5 |
-
def
|
| 6 |
-
|
| 7 |
-
|
|
|
|
| 8 |
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
audio.export(opus_file, format="opus")
|
| 12 |
-
|
| 13 |
-
# λ³νλ opus νμΌμ Hugging Face Spacesμ μ
λ‘λν©λλ€.
|
| 14 |
-
url = hf_hub_file_upload(opus_file)
|
| 15 |
-
|
| 16 |
-
return url
|
| 17 |
-
|
| 18 |
-
iface = gr.Interface(convert_to_opus, "file", "file")
|
| 19 |
-
iface.launch()
|
|
|
|
| 1 |
import gradio as gr
|
|
|
|
| 2 |
from pydub import AudioSegment
|
| 3 |
|
| 4 |
+
def convert(input_file):
|
| 5 |
+
sound = AudioSegment.from_mp3(input_file.name)
|
| 6 |
+
sound.export("output.opus", format="opus")
|
| 7 |
+
return "output.opus"
|
| 8 |
|
| 9 |
+
iface = gr.Interface(fn=convert, inputs=gr.inputs.File(label="Upload MP3"), outputs=gr.outputs.File(label="Download Opus"))
|
| 10 |
+
iface.launch(log=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|