videoenhancer / app.py
peterkros's picture
Update app.py
a30b14f verified
raw
history blame
1.1 kB
import gradio as gr
# Function to execute the anime upscaler command
def execute_upscaler(model_path, input_path, output_path, save_intermediate, async_mode):
# Build the command
command = [
"python3",
"anime_upscaler.py",
"-m", model_path,
"-i", input_path,
"-o", output_path
]
# Add optional flags
if save_intermediate:
command.append("-s")
if async_mode:
command.append("-a")
# Execute the command
import subprocess
result = subprocess.run(command, capture_output=True, text=True)
# Return the output of the command
return result.stdout
# Define the Gradio interface
iface = gr.Interface(
fn=execute_upscaler,
inputs=[
gr.File("file", label="Model Path (.pth)"),
gr.File("file", label="Input Video"),
gr.File("file", label="Output Path"),
gr.Checkbox("Save Intermediate", default=False),
gr.Checkbox("Async Mode", default=False),
],
outputs="text",
live=True,
capture_session=True
)
# Launch the Gradio interface
iface.launch()