Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -7,10 +7,7 @@ import re
|
|
7 |
gr.themes.Soft()
|
8 |
|
9 |
# Daftar format audio yang didukung
|
10 |
-
audio_formats = sorted([
|
11 |
-
'mp3', 'wav', 'aac', 'flac', 'ogg', 'm4a', 'alac', 'wma', 'aiff', 'opus',
|
12 |
-
'ape', 'caf', 'pcm', 'dts', 'tta', 'amr', 'mid', 'spx', 'wv', 'ra', 'tak'
|
13 |
-
])
|
14 |
|
15 |
def sanitize_filename(filename):
|
16 |
"""Sanitasi nama file dengan mengganti karakter khusus dan spasi."""
|
@@ -49,7 +46,7 @@ def convert_audio(audio_file, target_format):
|
|
49 |
interface = gr.Interface(
|
50 |
fn=convert_audio,
|
51 |
inputs=[
|
52 |
-
gr.File(label="Upload Audio File", type="filepath", file_types=[f'.{format}'
|
53 |
gr.Dropdown(label="Select Target Format", choices=audio_formats)
|
54 |
],
|
55 |
outputs=gr.File(label="Converted Audio File"),
|
|
|
7 |
gr.themes.Soft()
|
8 |
|
9 |
# Daftar format audio yang didukung
|
10 |
+
audio_formats = sorted(['MP3', 'WAV', 'AAC', 'FLAC', 'OGG', 'M4A', 'ALAC', 'WMA', 'AIFF', 'OPUS', 'APE', 'CAF', 'PCM', 'DTS', 'TTA', 'AMR', 'MID', 'SPX', 'WV', 'RA', 'TAK'])
|
|
|
|
|
|
|
11 |
|
12 |
def sanitize_filename(filename):
|
13 |
"""Sanitasi nama file dengan mengganti karakter khusus dan spasi."""
|
|
|
46 |
interface = gr.Interface(
|
47 |
fn=convert_audio,
|
48 |
inputs=[
|
49 |
+
gr.File(label="Upload Audio File", type="filepath", file_types=[f'.{format}' for format in audio_formats)],
|
50 |
gr.Dropdown(label="Select Target Format", choices=audio_formats)
|
51 |
],
|
52 |
outputs=gr.File(label="Converted Audio File"),
|