TDN-M commited on
Commit
aff5e42
·
verified ·
1 Parent(s): dddb41b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -7
app.py CHANGED
@@ -1,7 +1,6 @@
1
  import gradio as gr
2
  import subprocess
3
  import os
4
- import shutil
5
 
6
  def enhance_video(input_file):
7
  """
@@ -11,13 +10,10 @@ def enhance_video(input_file):
11
  if not input_file:
12
  return "Không có file video nào được tải lên."
13
 
14
- # Tạo đường dẫn tạm thời cho file đầu vào đầu ra
15
- input_path = "input.mp4"
16
  output_path = "enhanced_output.mp4"
17
 
18
- # Di chuyển file tải lên vào đường dẫn tạm thời
19
- shutil.copy(input_file, input_path)
20
-
21
  # Định nghĩa các bộ lọc ffmpeg
22
  filters = [
23
  "unsharp=5:5:1.0", # Làm sắc nét video
@@ -40,7 +36,7 @@ def enhance_video(input_file):
40
  try:
41
  # Thực thi lệnh ffmpeg
42
  subprocess.run(command, check=True)
43
- return output_path
44
  except subprocess.CalledProcessError as e:
45
  return f"Lỗi khi xử lý video: {e}"
46
 
 
1
  import gradio as gr
2
  import subprocess
3
  import os
 
4
 
5
  def enhance_video(input_file):
6
  """
 
10
  if not input_file:
11
  return "Không có file video nào được tải lên."
12
 
13
+ # Sử dụng đường dẫn file do Gradio cung cấp
14
+ input_path = input_file
15
  output_path = "enhanced_output.mp4"
16
 
 
 
 
17
  # Định nghĩa các bộ lọc ffmpeg
18
  filters = [
19
  "unsharp=5:5:1.0", # Làm sắc nét video
 
36
  try:
37
  # Thực thi lệnh ffmpeg
38
  subprocess.run(command, check=True)
39
+ return output_path # Trả về file đầu ra
40
  except subprocess.CalledProcessError as e:
41
  return f"Lỗi khi xử lý video: {e}"
42