Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -184,24 +184,30 @@ def process_video(video_url, segments, combine, progress=gr.Progress()):
|
|
| 184 |
# Disable Gradio analytics
|
| 185 |
utils.colab_check = lambda: True
|
| 186 |
|
| 187 |
-
with gr.Blocks(title="
|
| 188 |
-
gr.Markdown(
|
| 189 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 190 |
|
| 191 |
with gr.Row():
|
| 192 |
video_url = gr.Textbox(label="YouTube URL", placeholder="Enter YouTube URL here")
|
| 193 |
|
| 194 |
with gr.Row():
|
| 195 |
with gr.Column(scale=1):
|
| 196 |
-
with gr.
|
| 197 |
-
|
| 198 |
-
|
| 199 |
-
|
| 200 |
-
|
| 201 |
-
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
|
|
|
|
|
|
|
| 205 |
|
| 206 |
with gr.Column(scale=2):
|
| 207 |
segments = gr.Dataframe(
|
|
@@ -210,15 +216,32 @@ with gr.Blocks(title="Advanced YouTube Segment Downloader", theme=gr.themes.Soft
|
|
| 210 |
col_count=1,
|
| 211 |
datatype=["str"],
|
| 212 |
interactive=True,
|
| 213 |
-
label="Segments"
|
| 214 |
)
|
| 215 |
|
| 216 |
-
|
| 217 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 218 |
|
| 219 |
-
|
| 220 |
-
|
| 221 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 222 |
|
| 223 |
add_btn.click(
|
| 224 |
add_segment,
|
|
@@ -232,16 +255,15 @@ with gr.Blocks(title="Advanced YouTube Segment Downloader", theme=gr.themes.Soft
|
|
| 232 |
outputs=[progress, status, output_file]
|
| 233 |
)
|
| 234 |
|
| 235 |
-
|
| 236 |
-
|
| 237 |
-
inputs=[segments,
|
| 238 |
outputs=[segments]
|
| 239 |
)
|
| 240 |
|
| 241 |
-
|
| 242 |
-
|
| 243 |
-
|
| 244 |
-
inputs=[segments, gr.Slider(0, 100, step=1, label="Index to Remove")],
|
| 245 |
outputs=[segments]
|
| 246 |
)
|
| 247 |
|
|
|
|
| 184 |
# Disable Gradio analytics
|
| 185 |
utils.colab_check = lambda: True
|
| 186 |
|
| 187 |
+
with gr.Blocks(title="YouTube Segment Downloader", theme=gr.themes.Soft(primary_hue="indigo", secondary_hue="blue")) as iface:
|
| 188 |
+
gr.Markdown(
|
| 189 |
+
"""
|
| 190 |
+
# YouTube Segment Downloader
|
| 191 |
+
Download specific segments of YouTube videos with ease.
|
| 192 |
+
"""
|
| 193 |
+
)
|
| 194 |
|
| 195 |
with gr.Row():
|
| 196 |
video_url = gr.Textbox(label="YouTube URL", placeholder="Enter YouTube URL here")
|
| 197 |
|
| 198 |
with gr.Row():
|
| 199 |
with gr.Column(scale=1):
|
| 200 |
+
with gr.Group():
|
| 201 |
+
gr.Markdown("### Add Segment")
|
| 202 |
+
with gr.Row():
|
| 203 |
+
start_hours = gr.Number(label="Start", minimum=0, maximum=23, step=1, value=0)
|
| 204 |
+
start_minutes = gr.Number(label="", minimum=0, maximum=59, step=1, value=0)
|
| 205 |
+
start_seconds = gr.Number(label="", minimum=0, maximum=59, step=1, value=0)
|
| 206 |
+
with gr.Row():
|
| 207 |
+
end_hours = gr.Number(label="End", minimum=0, maximum=23, step=1, value=0)
|
| 208 |
+
end_minutes = gr.Number(label="", minimum=0, maximum=59, step=1, value=0)
|
| 209 |
+
end_seconds = gr.Number(label="", minimum=0, maximum=59, step=1, value=0)
|
| 210 |
+
add_btn = gr.Button("Add Segment", variant="primary")
|
| 211 |
|
| 212 |
with gr.Column(scale=2):
|
| 213 |
segments = gr.Dataframe(
|
|
|
|
| 216 |
col_count=1,
|
| 217 |
datatype=["str"],
|
| 218 |
interactive=True,
|
| 219 |
+
label="Segments to Download"
|
| 220 |
)
|
| 221 |
|
| 222 |
+
with gr.Row():
|
| 223 |
+
with gr.Column(scale=1):
|
| 224 |
+
combine = gr.Checkbox(label="Combine Segments", value=True)
|
| 225 |
+
with gr.Column(scale=2):
|
| 226 |
+
submit_btn = gr.Button("Download Segments", variant="primary", size="lg")
|
| 227 |
+
|
| 228 |
+
with gr.Row():
|
| 229 |
+
progress = gr.Slider(label="Progress", minimum=0, maximum=100, step=1, interactive=False)
|
| 230 |
+
|
| 231 |
+
with gr.Row():
|
| 232 |
+
status = gr.Textbox(label="Status", lines=3)
|
| 233 |
|
| 234 |
+
with gr.Row():
|
| 235 |
+
output_file = gr.File(label="Downloaded Video")
|
| 236 |
+
|
| 237 |
+
with gr.Accordion("Advanced Options", open=False):
|
| 238 |
+
with gr.Row():
|
| 239 |
+
remove_index = gr.Number(label="Remove Segment Index", minimum=0, step=1, value=0)
|
| 240 |
+
remove_btn = gr.Button("Remove Segment", variant="secondary")
|
| 241 |
+
with gr.Row():
|
| 242 |
+
old_index = gr.Number(label="Move From Index", minimum=0, step=1, value=0)
|
| 243 |
+
new_index = gr.Number(label="Move To Index", minimum=0, step=1, value=0)
|
| 244 |
+
move_btn = gr.Button("Move Segment", variant="secondary")
|
| 245 |
|
| 246 |
add_btn.click(
|
| 247 |
add_segment,
|
|
|
|
| 255 |
outputs=[progress, status, output_file]
|
| 256 |
)
|
| 257 |
|
| 258 |
+
remove_btn.click(
|
| 259 |
+
remove_segment,
|
| 260 |
+
inputs=[segments, remove_index],
|
| 261 |
outputs=[segments]
|
| 262 |
)
|
| 263 |
|
| 264 |
+
move_btn.click(
|
| 265 |
+
move_segment,
|
| 266 |
+
inputs=[segments, old_index, new_index],
|
|
|
|
| 267 |
outputs=[segments]
|
| 268 |
)
|
| 269 |
|