Spaces:
Runtime error
Runtime error
From MP4 to GIF
Browse files- app_pose.py +2 -1
- model.py +2 -41
app_pose.py
CHANGED
|
@@ -27,7 +27,8 @@ def create_demo(model: Model):
|
|
| 27 |
prompt = gr.Textbox(label='Prompt')
|
| 28 |
run_button = gr.Button(label='Run')
|
| 29 |
with gr.Column():
|
| 30 |
-
result = gr.Video(label="Generated Video")
|
|
|
|
| 31 |
|
| 32 |
input_video_path.change(on_video_path_update, None, pose_sequence_selector)
|
| 33 |
gallery_pose_sequence.select(pose_gallery_callback, None, input_video_path)
|
|
|
|
| 27 |
prompt = gr.Textbox(label='Prompt')
|
| 28 |
run_button = gr.Button(label='Run')
|
| 29 |
with gr.Column():
|
| 30 |
+
# result = gr.Video(label="Generated Video")
|
| 31 |
+
result = gr.Image(label="Generated Video")
|
| 32 |
|
| 33 |
input_video_path.change(on_video_path_update, None, pose_sequence_selector)
|
| 34 |
gallery_pose_sequence.select(pose_gallery_callback, None, input_video_path)
|
model.py
CHANGED
|
@@ -186,7 +186,8 @@ class Model:
|
|
| 186 |
split_to_chunks=True,
|
| 187 |
chunk_size=8,
|
| 188 |
)
|
| 189 |
-
return utils.
|
|
|
|
| 190 |
|
| 191 |
def process_controlnet_canny_db(self,
|
| 192 |
db_path,
|
|
@@ -255,46 +256,6 @@ class Model:
|
|
| 255 |
)
|
| 256 |
return utils.create_video(result, fps)
|
| 257 |
|
| 258 |
-
# def process_text2video(self, prompt, resolution=512, seed=24, num_frames=8, fps=4, t0=881, t1=941,
|
| 259 |
-
# use_cf_attn=True, use_motion_field=True, use_foreground_motion_field=False,
|
| 260 |
-
# smooth_bg=False, smooth_bg_strength=0.4, motion_field_strength=12):
|
| 261 |
-
|
| 262 |
-
# if self.model_type != ModelType.Text2Video:
|
| 263 |
-
# unet = UNet2DConditionModel.from_pretrained("runwayml/stable-diffusion-v1-5", subfolder="unet")
|
| 264 |
-
# self.set_model(ModelType.Text2Video, model_id="runwayml/stable-diffusion-v1-5", unet=unet)
|
| 265 |
-
# self.pipe.scheduler = DDIMScheduler.from_config(self.pipe.scheduler.config)
|
| 266 |
-
# self.pipe.unet.set_attn_processor(processor=self.text2video_attn_proc)
|
| 267 |
-
# self.generator.manual_seed(seed)
|
| 268 |
-
|
| 269 |
-
|
| 270 |
-
# added_prompt = "high quality, HD, 8K, trending on artstation, high focus, dramatic lighting"
|
| 271 |
-
# self.generator.manual_seed(seed)
|
| 272 |
-
|
| 273 |
-
# prompt = prompt.rstrip()
|
| 274 |
-
# if len(prompt) > 0 and (prompt[-1] == "," or prompt[-1] == "."):
|
| 275 |
-
# prompt = prompt.rstrip()[:-1]
|
| 276 |
-
# prompt = prompt.rstrip()
|
| 277 |
-
# prompt = prompt + ", "+added_prompt
|
| 278 |
-
|
| 279 |
-
# result = self.inference(prompt=[prompt],
|
| 280 |
-
# video_length=num_frames,
|
| 281 |
-
# height=resolution,
|
| 282 |
-
# width=resolution,
|
| 283 |
-
# num_inference_steps=50,
|
| 284 |
-
# guidance_scale=7.5,
|
| 285 |
-
# guidance_stop_step=1.0,
|
| 286 |
-
# t0=t0,
|
| 287 |
-
# t1=t1,
|
| 288 |
-
# use_foreground_motion_field=use_foreground_motion_field,
|
| 289 |
-
# motion_field_strength=motion_field_strength,
|
| 290 |
-
# use_motion_field=use_motion_field,
|
| 291 |
-
# smooth_bg=smooth_bg,
|
| 292 |
-
# smooth_bg_strength=smooth_bg_strength,
|
| 293 |
-
# seed=seed,
|
| 294 |
-
# output_type='numpy',
|
| 295 |
-
# )
|
| 296 |
-
# return utils.create_video(result, fps)
|
| 297 |
-
|
| 298 |
def process_text2video(self, prompt, motion_field_strength_x=12,motion_field_strength_y=12, n_prompt="", resolution=512, seed=24, num_frames=8, fps=4, t0=881, t1=941,
|
| 299 |
use_cf_attn=True, use_motion_field=True,
|
| 300 |
smooth_bg=False, smooth_bg_strength=0.4 ):
|
|
|
|
| 186 |
split_to_chunks=True,
|
| 187 |
chunk_size=8,
|
| 188 |
)
|
| 189 |
+
return utils.create_gif(result, fps)
|
| 190 |
+
# return utils.create_video(result, fps)
|
| 191 |
|
| 192 |
def process_controlnet_canny_db(self,
|
| 193 |
db_path,
|
|
|
|
| 256 |
)
|
| 257 |
return utils.create_video(result, fps)
|
| 258 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 259 |
def process_text2video(self, prompt, motion_field_strength_x=12,motion_field_strength_y=12, n_prompt="", resolution=512, seed=24, num_frames=8, fps=4, t0=881, t1=941,
|
| 260 |
use_cf_attn=True, use_motion_field=True,
|
| 261 |
smooth_bg=False, smooth_bg_strength=0.4 ):
|