Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -91,6 +91,9 @@ def get_video_fps(video_path):
|
|
| 91 |
|
| 92 |
return fps
|
| 93 |
|
|
|
|
|
|
|
|
|
|
| 94 |
def infer(ref_image_in, ref_video_in):
|
| 95 |
# check if 'outputs' dir exists and empty it if necessary
|
| 96 |
check_outputs_folder('./outputs')
|
|
@@ -109,7 +112,7 @@ def infer(ref_image_in, ref_video_in):
|
|
| 109 |
noise_aug_strength = 0
|
| 110 |
guidance_scale = 2.0
|
| 111 |
sample_stride = 2
|
| 112 |
-
fps =
|
| 113 |
seed = 42
|
| 114 |
|
| 115 |
# Create the data structure
|
|
@@ -179,6 +182,15 @@ with gr.Blocks() as demo:
|
|
| 179 |
ref_image_in = gr.Image(type="filepath")
|
| 180 |
ref_video_in = gr.Video()
|
| 181 |
submit_btn = gr.Button("Submit")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 182 |
output_video = gr.Video()
|
| 183 |
submit_btn.click(
|
| 184 |
fn = infer,
|
|
@@ -186,4 +198,4 @@ with gr.Blocks() as demo:
|
|
| 186 |
outputs = [output_video]
|
| 187 |
)
|
| 188 |
|
| 189 |
-
demo.launch()
|
|
|
|
| 91 |
|
| 92 |
return fps
|
| 93 |
|
| 94 |
+
def load_examples(ref_image_in, ref_video_in):
|
| 95 |
+
return "./examples/examples_result.mp4"
|
| 96 |
+
|
| 97 |
def infer(ref_image_in, ref_video_in):
|
| 98 |
# check if 'outputs' dir exists and empty it if necessary
|
| 99 |
check_outputs_folder('./outputs')
|
|
|
|
| 112 |
noise_aug_strength = 0
|
| 113 |
guidance_scale = 2.0
|
| 114 |
sample_stride = 2
|
| 115 |
+
fps = 16
|
| 116 |
seed = 42
|
| 117 |
|
| 118 |
# Create the data structure
|
|
|
|
| 182 |
ref_image_in = gr.Image(type="filepath")
|
| 183 |
ref_video_in = gr.Video()
|
| 184 |
submit_btn = gr.Button("Submit")
|
| 185 |
+
gr.Examples(
|
| 186 |
+
examples = [
|
| 187 |
+
["./examples/demo1.jpg", "./examples/preview_1.mp4"]
|
| 188 |
+
],
|
| 189 |
+
fn = load_examples,
|
| 190 |
+
inputs = [ref_image_in, ref_video_in],
|
| 191 |
+
outputs = [output_video],
|
| 192 |
+
cache_examples = False
|
| 193 |
+
)
|
| 194 |
output_video = gr.Video()
|
| 195 |
submit_btn.click(
|
| 196 |
fn = infer,
|
|
|
|
| 198 |
outputs = [output_video]
|
| 199 |
)
|
| 200 |
|
| 201 |
+
demo.launch(show_api=False, show_error=False)
|