Update app.py
Browse files
app.py
CHANGED
|
@@ -53,8 +53,10 @@ def controlnet(i, prompt, seed_in):
|
|
| 53 |
|
| 54 |
result = model.process_pose(np_img, prompt, a_prompt, n_prompt, num_samples,
|
| 55 |
image_resolution, detect_resolution, ddim_steps, scale, seed_in, eta)
|
| 56 |
-
print(result)
|
| 57 |
-
|
|
|
|
|
|
|
| 58 |
|
| 59 |
|
| 60 |
def get_frames(video_in):
|
|
@@ -130,14 +132,14 @@ def infer(prompt,video_in, seed_in, trim_value):
|
|
| 130 |
|
| 131 |
# exporting the image
|
| 132 |
#rgb_im.save(f"result_img-{i}.jpg")
|
| 133 |
-
|
| 134 |
-
|
| 135 |
|
| 136 |
-
|
| 137 |
print("finished !")
|
| 138 |
|
| 139 |
-
|
| 140 |
-
return controlnet_img
|
| 141 |
|
| 142 |
title = """
|
| 143 |
<div style="text-align: center; max-width: 700px; margin: 0 auto;">
|
|
@@ -194,7 +196,7 @@ with gr.Blocks(css='style.css') as demo:
|
|
| 194 |
seed_inp = gr.Slider(label="Seed", minimum=0, maximum=2147483647, step=1, value=123456)
|
| 195 |
trim_in = gr.Slider(label="Cut video at (s)", minimun=1, maximum=5, step=1, value=1)
|
| 196 |
with gr.Column():
|
| 197 |
-
status = gr.Textbox()
|
| 198 |
video_out = gr.Video(label="Pix2pix video result", elem_id="video-output")
|
| 199 |
gr.HTML("""
|
| 200 |
<a style="display:inline-block" href="https://huggingface.co/spaces/fffiloni/Pix2Pix-Video?duplicate=true"><img src="https://img.shields.io/badge/-Duplicate%20Space-blue?labelColor=white&style=flat&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAP5JREFUOE+lk7FqAkEURY+ltunEgFXS2sZGIbXfEPdLlnxJyDdYB62sbbUKpLbVNhyYFzbrrA74YJlh9r079973psed0cvUD4A+4HoCjsA85X0Dfn/RBLBgBDxnQPfAEJgBY+A9gALA4tcbamSzS4xq4FOQAJgCDwV2CPKV8tZAJcAjMMkUe1vX+U+SMhfAJEHasQIWmXNN3abzDwHUrgcRGmYcgKe0bxrblHEB4E/pndMazNpSZGcsZdBlYJcEL9Afo75molJyM2FxmPgmgPqlWNLGfwZGG6UiyEvLzHYDmoPkDDiNm9JR9uboiONcBXrpY1qmgs21x1QwyZcpvxt9NS09PlsPAAAAAElFTkSuQmCC&logoWidth=14" alt="Duplicate Space"></a>
|
|
@@ -208,8 +210,8 @@ with gr.Blocks(css='style.css') as demo:
|
|
| 208 |
share_button = gr.Button("Share to community", elem_id="share-btn")
|
| 209 |
|
| 210 |
inputs = [prompt,video_inp,seed_inp, trim_in]
|
| 211 |
-
|
| 212 |
-
outputs = [status]
|
| 213 |
|
| 214 |
|
| 215 |
gr.HTML(article)
|
|
|
|
| 53 |
|
| 54 |
result = model.process_pose(np_img, prompt, a_prompt, n_prompt, num_samples,
|
| 55 |
image_resolution, detect_resolution, ddim_steps, scale, seed_in, eta)
|
| 56 |
+
print(result[0])
|
| 57 |
+
im = Image.fromarray(result[0])
|
| 58 |
+
im.save(f"your_file" + {i} + ".jpeg")
|
| 59 |
+
return f"your_file" + {i} + ".jpeg"
|
| 60 |
|
| 61 |
|
| 62 |
def get_frames(video_in):
|
|
|
|
| 132 |
|
| 133 |
# exporting the image
|
| 134 |
#rgb_im.save(f"result_img-{i}.jpg")
|
| 135 |
+
result_frames.append(controlnet_img)
|
| 136 |
+
print("frame " + i + "/" + str(n_frame) + ": done;")
|
| 137 |
|
| 138 |
+
final_vid = create_video(result_frames, fps)
|
| 139 |
print("finished !")
|
| 140 |
|
| 141 |
+
return final_vid, gr.Group.update(visible=True)
|
| 142 |
+
#return controlnet_img
|
| 143 |
|
| 144 |
title = """
|
| 145 |
<div style="text-align: center; max-width: 700px; margin: 0 auto;">
|
|
|
|
| 196 |
seed_inp = gr.Slider(label="Seed", minimum=0, maximum=2147483647, step=1, value=123456)
|
| 197 |
trim_in = gr.Slider(label="Cut video at (s)", minimun=1, maximum=5, step=1, value=1)
|
| 198 |
with gr.Column():
|
| 199 |
+
#status = gr.Textbox()
|
| 200 |
video_out = gr.Video(label="Pix2pix video result", elem_id="video-output")
|
| 201 |
gr.HTML("""
|
| 202 |
<a style="display:inline-block" href="https://huggingface.co/spaces/fffiloni/Pix2Pix-Video?duplicate=true"><img src="https://img.shields.io/badge/-Duplicate%20Space-blue?labelColor=white&style=flat&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAP5JREFUOE+lk7FqAkEURY+ltunEgFXS2sZGIbXfEPdLlnxJyDdYB62sbbUKpLbVNhyYFzbrrA74YJlh9r079973psed0cvUD4A+4HoCjsA85X0Dfn/RBLBgBDxnQPfAEJgBY+A9gALA4tcbamSzS4xq4FOQAJgCDwV2CPKV8tZAJcAjMMkUe1vX+U+SMhfAJEHasQIWmXNN3abzDwHUrgcRGmYcgKe0bxrblHEB4E/pndMazNpSZGcsZdBlYJcEL9Afo75molJyM2FxmPgmgPqlWNLGfwZGG6UiyEvLzHYDmoPkDDiNm9JR9uboiONcBXrpY1qmgs21x1QwyZcpvxt9NS09PlsPAAAAAElFTkSuQmCC&logoWidth=14" alt="Duplicate Space"></a>
|
|
|
|
| 210 |
share_button = gr.Button("Share to community", elem_id="share-btn")
|
| 211 |
|
| 212 |
inputs = [prompt,video_inp,seed_inp, trim_in]
|
| 213 |
+
outputs = [video_out, share_group]
|
| 214 |
+
#outputs = [status]
|
| 215 |
|
| 216 |
|
| 217 |
gr.HTML(article)
|