Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -6,6 +6,15 @@ import glob
|
|
6 |
import shutil
|
7 |
import gradio as gr
|
8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
os.system("chmod +x fdkaac") # Make sure fdkaac is executable
|
10 |
|
11 |
accel = 'auto'
|
@@ -123,7 +132,9 @@ async def process_conversion(use_youtube, youtube_url, video_file, downscale, fa
|
|
123 |
else:
|
124 |
if not video_file:
|
125 |
return "No video provided.", None
|
126 |
-
ext = os.path.splitext(video_file.name)[1]
|
|
|
|
|
127 |
input_path = os.path.join(UPLOAD_FOLDER, f"{uuid.uuid4()}{ext}")
|
128 |
shutil.copy2(video_file.name, input_path)
|
129 |
|
@@ -152,7 +163,7 @@ with gr.Blocks(theme=gr.themes.Default(primary_hue="rose")) as demo:
|
|
152 |
with gr.Row():
|
153 |
use_youtube = gr.Checkbox(label="π Use YouTube URL (usually broken here)", value=False)
|
154 |
youtube_url = gr.Textbox(label="YouTube URL", placeholder="Paste YouTube URL here")
|
155 |
-
video_file = gr.File(label="π Upload Video File", file_types=["
|
156 |
|
157 |
gr.Markdown("### βοΈ **Conversion Settings**")
|
158 |
with gr.Group():
|
|
|
6 |
import shutil
|
7 |
import gradio as gr
|
8 |
|
9 |
+
allowed_extensions = [
|
10 |
+
".3g2", ".3gp", ".3gpp", ".avi", ".cavs", ".dv", ".dvr", ".flv", ".m2ts",
|
11 |
+
".m4v", ".mkv", ".mod", ".mov", ".mp4", ".mpeg", ".mpg", ".mts", ".mxf",
|
12 |
+
".ogg", ".rm", ".rmvb", ".swf", ".ts", ".vob", ".webm", ".wmv", ".wtv",
|
13 |
+
".ogv", ".opus", ".aac", ".ac3", ".aif", ".aifc", ".aiff", ".amr", ".au",
|
14 |
+
".caf", ".dss", ".flac", ".m4a", ".m4b", ".mp3", ".oga", ".voc", ".wav",
|
15 |
+
".weba", ".wma"
|
16 |
+
]
|
17 |
+
|
18 |
os.system("chmod +x fdkaac") # Make sure fdkaac is executable
|
19 |
|
20 |
accel = 'auto'
|
|
|
132 |
else:
|
133 |
if not video_file:
|
134 |
return "No video provided.", None
|
135 |
+
ext = os.path.splitext(video_file.name)[1].lower()
|
136 |
+
if ext not in allowed_extensions:
|
137 |
+
return f"Unsupported file type: {ext}", None
|
138 |
input_path = os.path.join(UPLOAD_FOLDER, f"{uuid.uuid4()}{ext}")
|
139 |
shutil.copy2(video_file.name, input_path)
|
140 |
|
|
|
163 |
with gr.Row():
|
164 |
use_youtube = gr.Checkbox(label="π Use YouTube URL (usually broken here)", value=False)
|
165 |
youtube_url = gr.Textbox(label="YouTube URL", placeholder="Paste YouTube URL here")
|
166 |
+
video_file = gr.File(label="π Upload Video File", file_types=[".3g2", ".3gp", ".3gpp", ".avi", ".cavs", ".dv", ".dvr", ".flv", ".m2ts", ".m4v", ".mkv", ".mod", ".mov", ".mp4", ".mpeg", ".mpg", ".mts", ".mxf", ".ogg", ".rm", ".rmvb", ".swf", ".ts", ".vob", ".webm", ".wmv", ".wtv", ".ogv", ".opus", ".aac", ".ac3", ".aif", ".aifc", ".aiff", ".amr", ".au", ".caf", ".dss", ".flac", ".m4a", ".m4b", ".mp3", ".oga", ".voc", ".wav", ".weba", ".wma"])
|
167 |
|
168 |
gr.Markdown("### βοΈ **Conversion Settings**")
|
169 |
with gr.Group():
|