Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -5,7 +5,7 @@ import gradio as gr
|
|
| 5 |
def check_video_size(video_path, max_size_mb=1000): # Allow up to 1 GB
|
| 6 |
size_mb = os.path.getsize(video_path) / (1024 * 1024)
|
| 7 |
if size_mb > max_size_mb:
|
| 8 |
-
raise gr.Error(f"Video is too large (max {max_size_mb} MB allowed).")
|
| 9 |
|
| 10 |
def split_video_into_chunks(video_path, chunk_duration=6, output_dir="video_chunks"):
|
| 11 |
# Create output directory
|
|
@@ -53,7 +53,7 @@ def process_video(video, chunk_duration):
|
|
| 53 |
|
| 54 |
# Gradio Interface
|
| 55 |
def gradio_interface(video, chunk_duration, progress=gr.Progress()):
|
| 56 |
-
progress(0, desc="Uploading video...")
|
| 57 |
progress(0.5, desc="Processing video...")
|
| 58 |
chunk_files = process_video(video, chunk_duration)
|
| 59 |
progress(1.0, desc="Done!")
|
|
@@ -68,8 +68,8 @@ iface = gr.Interface(
|
|
| 68 |
],
|
| 69 |
outputs=gr.Files(label="Download Chunks"),
|
| 70 |
title="Video Splitter with Custom Chunk Duration",
|
| 71 |
-
description="Upload a video (max 1 GB) and choose the chunk duration in seconds. The app will split the video into chunks for download."
|
| 72 |
)
|
| 73 |
|
| 74 |
-
# Launch the app
|
| 75 |
iface.launch()
|
|
|
|
| 5 |
def check_video_size(video_path, max_size_mb=1000): # Allow up to 1 GB
|
| 6 |
size_mb = os.path.getsize(video_path) / (1024 * 1024)
|
| 7 |
if size_mb > max_size_mb:
|
| 8 |
+
raise gr.Error(f"Video is too large (max {max_size_mb} MB allowed). Please compress the video before uploading.")
|
| 9 |
|
| 10 |
def split_video_into_chunks(video_path, chunk_duration=6, output_dir="video_chunks"):
|
| 11 |
# Create output directory
|
|
|
|
| 53 |
|
| 54 |
# Gradio Interface
|
| 55 |
def gradio_interface(video, chunk_duration, progress=gr.Progress()):
|
| 56 |
+
progress(0, desc="Uploading video... (This may take a while for large files)")
|
| 57 |
progress(0.5, desc="Processing video...")
|
| 58 |
chunk_files = process_video(video, chunk_duration)
|
| 59 |
progress(1.0, desc="Done!")
|
|
|
|
| 68 |
],
|
| 69 |
outputs=gr.Files(label="Download Chunks"),
|
| 70 |
title="Video Splitter with Custom Chunk Duration",
|
| 71 |
+
description="Upload a video (max 1 GB) and choose the chunk duration in seconds. The app will split the video into chunks for download. **Tip:** Compress your video before uploading for faster processing."
|
| 72 |
)
|
| 73 |
|
| 74 |
+
# Launch the app
|
| 75 |
iface.launch()
|