eienmojiki commited on
Commit
e07bfd3
·
verified ·
1 Parent(s): e9a65c7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -1,6 +1,7 @@
1
  import gradio as gr
2
  import subprocess
3
  import os
 
4
 
5
  def get_file_size(file_path):
6
  """Get file size in a human-readable format"""
@@ -15,6 +16,7 @@ def get_file_size(file_path):
15
  return f"{size_bytes:.2f} {unit}"
16
  size_bytes /= 1024
17
 
 
18
  def compress_video(video_file):
19
  """Compresses the uploaded video using FFmpeg and returns the output video path and file sizes."""
20
  if video_file is None:
@@ -34,7 +36,9 @@ def compress_video(video_file):
34
 
35
  # Execute ffmpeg command
36
  command = [
37
- "ffmpeg",
 
 
38
  "-i", input_path,
39
  "-vcodec", "libx264",
40
  "-crf", "28",
 
1
  import gradio as gr
2
  import subprocess
3
  import os
4
+ import spaces
5
 
6
  def get_file_size(file_path):
7
  """Get file size in a human-readable format"""
 
16
  return f"{size_bytes:.2f} {unit}"
17
  size_bytes /= 1024
18
 
19
+ @spaces.GPU()
20
  def compress_video(video_file):
21
  """Compresses the uploaded video using FFmpeg and returns the output video path and file sizes."""
22
  if video_file is None:
 
36
 
37
  # Execute ffmpeg command
38
  command = [
39
+ "ffmpeg",
40
+ "-hwaccel",
41
+ "cuda",
42
  "-i", input_path,
43
  "-vcodec", "libx264",
44
  "-crf", "28",