VicFonch
commited on
app.py: Fix bug render duplication
Browse files
app.py
CHANGED
@@ -78,31 +78,33 @@ def build_demo() -> gr.Blocks:
|
|
78 |
</div>
|
79 |
</div>
|
80 |
"""
|
|
|
81 |
with gr.Blocks() as demo:
|
82 |
gr.HTML(header)
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
),
|
102 |
examples=[
|
103 |
["_data/example_images/frame1.png", "_data/example_images/frame3.png", 0.5, 1],
|
104 |
],
|
|
|
105 |
)
|
|
|
106 |
return demo
|
107 |
|
108 |
if __name__ == "__main__":
|
|
|
78 |
</div>
|
79 |
</div>
|
80 |
"""
|
81 |
+
|
82 |
with gr.Blocks() as demo:
|
83 |
gr.HTML(header)
|
84 |
+
|
85 |
+
with gr.Row():
|
86 |
+
img0 = gr.Image(type="pil", label="Initial Image (frame1)")
|
87 |
+
img2 = gr.Image(type="pil", label="Final Image (frame3)")
|
88 |
+
|
89 |
+
with gr.Row():
|
90 |
+
tau = gr.Slider(0.0, 1.0, step=0.05, value=0.5, label="Tau Value (only if Num Samples = 1)")
|
91 |
+
samples = gr.Slider(1, 20, step=1, value=1, label="Number of Samples")
|
92 |
+
|
93 |
+
btn = gr.Button("Generate")
|
94 |
+
|
95 |
+
with gr.Row():
|
96 |
+
output_img = gr.Image(label="Interpolated Image (if num_samples = 1)")
|
97 |
+
output_vid = gr.Video(label="Interpolation in video (if num_samples > 1)")
|
98 |
+
|
99 |
+
btn.click(interpolate, inputs=[img0, img2, tau, samples], outputs=[output_img, output_vid])
|
100 |
+
|
101 |
+
gr.Examples(
|
|
|
102 |
examples=[
|
103 |
["_data/example_images/frame1.png", "_data/example_images/frame3.png", 0.5, 1],
|
104 |
],
|
105 |
+
inputs=[img0, img2, tau, samples],
|
106 |
)
|
107 |
+
|
108 |
return demo
|
109 |
|
110 |
if __name__ == "__main__":
|