fffiloni commited on
Commit
b44de48
1 Parent(s): 0438521

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -1,4 +1,5 @@
1
  import os
 
2
  import gradio as gr
3
  import subprocess
4
  import datetime
@@ -33,6 +34,8 @@ def check_for_mp4_in_outputs(given_folder):
33
 
34
  def infer(input_video, cropped_and_aligned):
35
 
 
 
36
  filepath = input_video
37
  # Get the current timestamp
38
  timestamp = datetime.datetime.now().strftime("%Y%m%d%H%M%S")
@@ -44,7 +47,9 @@ def infer(input_video, cropped_and_aligned):
44
  run_command(f"{sys.executable} inference_keep.py -i={filepath} -o={output_folder_name} --has_aligned --save_video -s=1")
45
  else:
46
  run_command(f"{sys.executable} inference_keep.py -i={filepath} -o={output_folder_name} --draw_box --save_video -s=1 --bg_upsampler=realesrgan")
47
-
 
 
48
  # Call the function and print the result
49
  this_infer_folder = os.path.splitext(os.path.basename(filepath))[0]
50
  joined_path = os.path.join(output_folder_name, this_infer_folder)
 
1
  import os
2
+ import torch
3
  import gradio as gr
4
  import subprocess
5
  import datetime
 
34
 
35
  def infer(input_video, cropped_and_aligned):
36
 
37
+ torch.cuda.empty_cache()
38
+
39
  filepath = input_video
40
  # Get the current timestamp
41
  timestamp = datetime.datetime.now().strftime("%Y%m%d%H%M%S")
 
47
  run_command(f"{sys.executable} inference_keep.py -i={filepath} -o={output_folder_name} --has_aligned --save_video -s=1")
48
  else:
49
  run_command(f"{sys.executable} inference_keep.py -i={filepath} -o={output_folder_name} --draw_box --save_video -s=1 --bg_upsampler=realesrgan")
50
+
51
+ torch.cuda.empty_cache()
52
+
53
  # Call the function and print the result
54
  this_infer_folder = os.path.splitext(os.path.basename(filepath))[0]
55
  joined_path = os.path.join(output_folder_name, this_infer_folder)