Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
import gradio as gr
|
2 |
import subprocess
|
3 |
import os
|
|
|
4 |
|
5 |
os.system("pip install -r requirements.txt")
|
6 |
-
#import spaces
|
7 |
|
8 |
def get_file_size(file_path):
|
9 |
"""Get file size in a human-readable format"""
|
@@ -18,7 +18,7 @@ def get_file_size(file_path):
|
|
18 |
return f"{size_bytes:.2f} {unit}"
|
19 |
size_bytes /= 1024
|
20 |
|
21 |
-
|
22 |
def compress_video(video_file):
|
23 |
"""Compresses the uploaded video using FFmpeg and returns the output video path and file sizes."""
|
24 |
if video_file is None:
|
@@ -39,8 +39,8 @@ def compress_video(video_file):
|
|
39 |
# Execute ffmpeg command
|
40 |
command = [
|
41 |
"ffmpeg",
|
42 |
-
|
43 |
-
|
44 |
"-i", input_path,
|
45 |
"-vcodec", "libx264",
|
46 |
"-crf", "28",
|
|
|
1 |
import gradio as gr
|
2 |
import subprocess
|
3 |
import os
|
4 |
+
import spaces
|
5 |
|
6 |
os.system("pip install -r requirements.txt")
|
|
|
7 |
|
8 |
def get_file_size(file_path):
|
9 |
"""Get file size in a human-readable format"""
|
|
|
18 |
return f"{size_bytes:.2f} {unit}"
|
19 |
size_bytes /= 1024
|
20 |
|
21 |
+
@spaces.GPU()
|
22 |
def compress_video(video_file):
|
23 |
"""Compresses the uploaded video using FFmpeg and returns the output video path and file sizes."""
|
24 |
if video_file is None:
|
|
|
39 |
# Execute ffmpeg command
|
40 |
command = [
|
41 |
"ffmpeg",
|
42 |
+
"-hwaccel",
|
43 |
+
"cuda",
|
44 |
"-i", input_path,
|
45 |
"-vcodec", "libx264",
|
46 |
"-crf", "28",
|