Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,17 +1,15 @@
|
|
1 |
import gradio as gr
|
2 |
from pathlib import Path
|
3 |
import subprocess
|
4 |
-
from inference_img import *
|
5 |
-
import spaces
|
6 |
|
7 |
# Constants
|
8 |
-
OUTPUT_GIF = Path("
|
9 |
-
FRAME1_PATH = Path("
|
10 |
-
FRAME2_PATH = Path("
|
11 |
|
12 |
# Function to generate GIF
|
13 |
-
def generate_demo_gif(
|
14 |
-
|
15 |
try:
|
16 |
result = subprocess.run([
|
17 |
"python", "inference_img.py",
|
@@ -35,17 +33,17 @@ def generate_demo_gif(img1, img2):
|
|
35 |
# Gradio UI
|
36 |
with gr.Blocks() as demo_ui:
|
37 |
with gr.Tab("Demo"):
|
38 |
-
gr.Markdown("###
|
39 |
with gr.Row():
|
40 |
-
|
41 |
-
|
42 |
generate_btn = gr.Button("Generate GIF")
|
43 |
-
output_gif = gr.Image(label="
|
44 |
status_msg = gr.Markdown()
|
45 |
|
46 |
generate_btn.click(
|
47 |
fn=generate_demo_gif,
|
48 |
-
inputs=[
|
49 |
outputs=[output_gif, status_msg]
|
50 |
)
|
51 |
|
|
|
1 |
import gradio as gr
|
2 |
from pathlib import Path
|
3 |
import subprocess
|
4 |
+
from inference_img import * # Assuming necessary functions are exposed here
|
|
|
5 |
|
6 |
# Constants
|
7 |
+
OUTPUT_GIF = Path("demo/output.gif")
|
8 |
+
FRAME1_PATH = Path("demo/frame1.jpg")
|
9 |
+
FRAME2_PATH = Path("demo/frame2.jpg")
|
10 |
|
11 |
# Function to generate GIF
|
12 |
+
def generate_demo_gif(_1, _2):
|
|
|
13 |
try:
|
14 |
result = subprocess.run([
|
15 |
"python", "inference_img.py",
|
|
|
33 |
# Gradio UI
|
34 |
with gr.Blocks() as demo_ui:
|
35 |
with gr.Tab("Demo"):
|
36 |
+
gr.Markdown("### Preview frames and generate animation")
|
37 |
with gr.Row():
|
38 |
+
img1_preview = gr.Image(value=str(FRAME1_PATH), label="Frame 1", interactive=False)
|
39 |
+
img2_preview = gr.Image(value=str(FRAME2_PATH), label="Frame 2", interactive=False)
|
40 |
generate_btn = gr.Button("Generate GIF")
|
41 |
+
output_gif = gr.Image(label="Animated GIF")
|
42 |
status_msg = gr.Markdown()
|
43 |
|
44 |
generate_btn.click(
|
45 |
fn=generate_demo_gif,
|
46 |
+
inputs=[img1_preview, img2_preview], # Non-interactive but passed to match fn signature
|
47 |
outputs=[output_gif, status_msg]
|
48 |
)
|
49 |
|