peterkros commited on
Commit
a30b14f
1 Parent(s): 7650641

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +40 -4
app.py CHANGED
@@ -1,7 +1,43 @@
1
  import gradio as gr
2
 
3
- def greet(name):
4
- return "Hello " + name + "!!"
 
 
 
 
 
 
 
 
5
 
6
- iface = gr.Interface(fn=greet, inputs="text", outputs="text")
7
- iface.launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
 
3
+ # Function to execute the anime upscaler command
4
+ def execute_upscaler(model_path, input_path, output_path, save_intermediate, async_mode):
5
+ # Build the command
6
+ command = [
7
+ "python3",
8
+ "anime_upscaler.py",
9
+ "-m", model_path,
10
+ "-i", input_path,
11
+ "-o", output_path
12
+ ]
13
 
14
+ # Add optional flags
15
+ if save_intermediate:
16
+ command.append("-s")
17
+ if async_mode:
18
+ command.append("-a")
19
+
20
+ # Execute the command
21
+ import subprocess
22
+ result = subprocess.run(command, capture_output=True, text=True)
23
+
24
+ # Return the output of the command
25
+ return result.stdout
26
+
27
+ # Define the Gradio interface
28
+ iface = gr.Interface(
29
+ fn=execute_upscaler,
30
+ inputs=[
31
+ gr.File("file", label="Model Path (.pth)"),
32
+ gr.File("file", label="Input Video"),
33
+ gr.File("file", label="Output Path"),
34
+ gr.Checkbox("Save Intermediate", default=False),
35
+ gr.Checkbox("Async Mode", default=False),
36
+ ],
37
+ outputs="text",
38
+ live=True,
39
+ capture_session=True
40
+ )
41
+
42
+ # Launch the Gradio interface
43
+ iface.launch()