Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -8,6 +8,10 @@ from pydub import AudioSegment
|
|
| 8 |
from moviepy import VideoFileClip
|
| 9 |
|
| 10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
# ---------- AUDIO PROCESSING ----------
|
| 12 |
def convert_audio(input_files, output_format, session_id, merge_files, gap_duration):
|
| 13 |
"""Converts or merges a list of audio files."""
|
|
@@ -119,20 +123,15 @@ def update_format_choices(conversion_type):
|
|
| 119 |
return gr.Dropdown(choices=audio_formats, value="mp3", label="Output Audio Format")
|
| 120 |
|
| 121 |
|
| 122 |
-
audio_formats = ["mp3", "wav", "flac", "ogg", "aac", "m4a", "aiff", "wma", "opus"]
|
| 123 |
-
video_formats = ["mp4", "webm", "mkv", "avi", "mov", "flv"]
|
| 124 |
-
|
| 125 |
-
|
| 126 |
# ---------- UI ----------
|
| 127 |
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
| 128 |
-
gr.
|
| 129 |
-
gr.Markdown("Use the tabs below to switch between the Audio and Video converters.")
|
| 130 |
|
| 131 |
with gr.Tabs():
|
| 132 |
# AUDIO TAB
|
| 133 |
with gr.TabItem("πΆ Audio Converter"):
|
| 134 |
-
gr.
|
| 135 |
-
gr.
|
| 136 |
|
| 137 |
with gr.Row():
|
| 138 |
with gr.Column(scale=2):
|
|
@@ -153,8 +152,8 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
| 153 |
|
| 154 |
# VIDEO TAB
|
| 155 |
with gr.TabItem("π¬ Video Converter"):
|
| 156 |
-
gr.
|
| 157 |
-
gr.
|
| 158 |
|
| 159 |
with gr.Row():
|
| 160 |
with gr.Column(scale=2):
|
|
|
|
| 8 |
from moviepy import VideoFileClip
|
| 9 |
|
| 10 |
|
| 11 |
+
audio_formats = ["mp3", "wav", "flac", "ogg", "aac", "m4a", "aiff", "wma", "opus"]
|
| 12 |
+
video_formats = ["mp4", "webm", "mkv", "avi", "mov", "flv"]
|
| 13 |
+
|
| 14 |
+
|
| 15 |
# ---------- AUDIO PROCESSING ----------
|
| 16 |
def convert_audio(input_files, output_format, session_id, merge_files, gap_duration):
|
| 17 |
"""Converts or merges a list of audio files."""
|
|
|
|
| 123 |
return gr.Dropdown(choices=audio_formats, value="mp3", label="Output Audio Format")
|
| 124 |
|
| 125 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 126 |
# ---------- UI ----------
|
| 127 |
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
| 128 |
+
gr.HTML("<center><h1>Universal Media Converter π§π¬</h1></center>")
|
|
|
|
| 129 |
|
| 130 |
with gr.Tabs():
|
| 131 |
# AUDIO TAB
|
| 132 |
with gr.TabItem("πΆ Audio Converter"):
|
| 133 |
+
gr.HTML("<center><h2>Convert and Merge Audio Files</h2></center>")
|
| 134 |
+
gr.HTML("<center>Upload one or more audio files and select the output format. You can also merge all files into a single track.</center>")
|
| 135 |
|
| 136 |
with gr.Row():
|
| 137 |
with gr.Column(scale=2):
|
|
|
|
| 152 |
|
| 153 |
# VIDEO TAB
|
| 154 |
with gr.TabItem("π¬ Video Converter"):
|
| 155 |
+
gr.HTML("<center><h2>Convert Video and Extract Audio</h2></center>")
|
| 156 |
+
gr.HTML("<center>Upload a video file, then choose whether to convert it to another video format or to extract its audio track.</center>")
|
| 157 |
|
| 158 |
with gr.Row():
|
| 159 |
with gr.Column(scale=2):
|