peterkros commited on
Commit
388f757
·
verified ·
1 Parent(s): d87c50b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -1
app.py CHANGED
@@ -1,5 +1,6 @@
1
  import gradio as gr
2
  import os
 
3
 
4
  # Function to execute the anime upscaler command
5
  def execute_upscaler(input_video, output_path, save_intermediate, async_mode):
@@ -7,12 +8,19 @@ def execute_upscaler(input_video, output_path, save_intermediate, async_mode):
7
  script_directory = os.path.dirname(os.path.realpath(__file__))
8
  model_path = os.path.join(script_directory, "RealESRGAN_x4plus_anime_6B.pth")
9
 
 
 
 
 
 
 
 
10
  # Build the command
11
  command = [
12
  "python3",
13
  "anime_upscaler.py",
14
  "-m", model_path,
15
- "-i", input_video.name,
16
  "-o", output_path
17
  ]
18
 
 
1
  import gradio as gr
2
  import os
3
+ import tempfile
4
 
5
  # Function to execute the anime upscaler command
6
  def execute_upscaler(input_video, output_path, save_intermediate, async_mode):
 
8
  script_directory = os.path.dirname(os.path.realpath(__file__))
9
  model_path = os.path.join(script_directory, "RealESRGAN_x4plus_anime_6B.pth")
10
 
11
+ # Create a temporary directory to store the uploaded video
12
+ temp_dir = tempfile.mkdtemp()
13
+
14
+ # Save the uploaded video to the temporary directory
15
+ input_video_path = os.path.join(temp_dir, "input_video.mp4")
16
+ input_video.save(input_video_path)
17
+
18
  # Build the command
19
  command = [
20
  "python3",
21
  "anime_upscaler.py",
22
  "-m", model_path,
23
+ "-i", input_video_path,
24
  "-o", output_path
25
  ]
26