Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,16 +2,17 @@ import gradio as gr
|
|
| 2 |
import os
|
| 3 |
|
| 4 |
# Function to execute the anime upscaler command
|
| 5 |
-
def execute_upscaler(
|
| 6 |
# Determine the path to the model file in the same directory
|
| 7 |
-
|
|
|
|
| 8 |
|
| 9 |
# Build the command
|
| 10 |
command = [
|
| 11 |
"python3",
|
| 12 |
"anime_upscaler.py",
|
| 13 |
"-m", model_path,
|
| 14 |
-
"-i",
|
| 15 |
"-o", output_path
|
| 16 |
]
|
| 17 |
|
|
@@ -32,8 +33,8 @@ def execute_upscaler(input_path, output_path, save_intermediate, async_mode):
|
|
| 32 |
iface = gr.Interface(
|
| 33 |
fn=execute_upscaler,
|
| 34 |
inputs=[
|
| 35 |
-
gr.File("
|
| 36 |
-
gr.File("
|
| 37 |
gr.Checkbox("Save Intermediate", default=False),
|
| 38 |
gr.Checkbox("Async Mode", default=False),
|
| 39 |
],
|
|
|
|
| 2 |
import os
|
| 3 |
|
| 4 |
# Function to execute the anime upscaler command
|
| 5 |
+
def execute_upscaler(input_video, output_path, save_intermediate, async_mode):
|
| 6 |
# Determine the path to the model file in the same directory
|
| 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 |
|
|
|
|
| 33 |
iface = gr.Interface(
|
| 34 |
fn=execute_upscaler,
|
| 35 |
inputs=[
|
| 36 |
+
gr.File("input_video", label="Input Video"),
|
| 37 |
+
gr.File("output_path", label="Output Path"),
|
| 38 |
gr.Checkbox("Save Intermediate", default=False),
|
| 39 |
gr.Checkbox("Async Mode", default=False),
|
| 40 |
],
|