Spaces:
Runtime error
Runtime error
Support raw pose image and depth image
Browse filesFiles changed (3)
- app_depth.py+3
- app_pose.py+3
- model.py+26-15
12 unmodified lines131415161718192048 unmodified lines6970717273747512 unmodified lines prompt = gr.Textbox(label='Prompt') run_button = gr.Button(label='Run') with gr.Accordion('Advanced options', open=False): is_depth_image = gr.Checkbox(label='Is depth image', value=False) num_samples = gr.Slider(label='Images', minimum=1, maximum=max_images,48 unmodified lines num_steps, guidance_scale, seed, is_depth_image, ] prompt.submit(fn=process, inputs=inputs, outputs=result) run_button.click(fn=process,12 unmodified lines131415161718192048 unmodified lines6970717273747512 unmodified lines prompt = gr.Textbox(label='Prompt') run_button = gr.Button(label='Run') with gr.Accordion('Advanced options', open=False): is_pose_image = gr.Checkbox(label='Is pose image', value=False) num_samples = gr.Slider(label='Images', minimum=1, maximum=max_images,48 unmodified lines num_steps, guidance_scale, seed, is_pose_image, ] prompt.submit(fn=process, inputs=inputs, outputs=result) run_button.click(fn=process,437 unmodified lines43843944044144244344344444544644744844945044444544644744844945045145245345445545611 unmodified lines46846947047147247347447547647747847948061 unmodified lines54254354454554654754854254354454554654754854955055155255355455555655755855956010 unmodified lines571572573574575576577578579580581582583437 unmodified lines input_image: np.ndarray, image_resolution: int, detect_resolution: int, is_pose_image: bool, ) -> tuple[PIL.Image.Image, PIL.Image.Image]: input_image = HWC3(input_image) control_image, _ = apply_openpose( resize_image(input_image, detect_resolution)) control_image = HWC3(control_image) image = resize_image(input_image, image_resolution) H, W = image.shape[:2]
control_image = cv2.resize(control_image, (W, H), interpolation=cv2.INTER_NEAREST) if not is_pose_image: control_image, _ = apply_openpose( resize_image(input_image, detect_resolution)) control_image = HWC3(control_image) image = resize_image(input_image, image_resolution) H, W = image.shape[:2] control_image = cv2.resize(control_image, (W, H), interpolation=cv2.INTER_NEAREST) else: control_image = input_image
return PIL.Image.fromarray(control_image), PIL.Image.fromarray( control_image)11 unmodified lines num_steps: int, guidance_scale: float, seed: int, is_pose_image: bool, ) -> list[PIL.Image.Image]: control_image, vis_control_image = self.preprocess_pose( input_image=input_image, image_resolution=image_resolution, detect_resolution=detect_resolution, is_pose_image=is_pose_image, ) return self.process( task_name='pose',61 unmodified lines input_image: np.ndarray, image_resolution: int, detect_resolution: int, is_depth_image: bool, ) -> tuple[PIL.Image.Image, PIL.Image.Image]: input_image = HWC3(input_image) if not is_depth_image: control_image, _ = apply_midas( resize_image(input_image, detect_resolution)) control_image = HWC3(control_image) image = resize_image(input_image, image_resolution) H, W = image.shape[:2] control_image = cv2.resize(control_image, (W, H), interpolation=cv2.INTER_LINEAR) control_image, _ = apply_midas( resize_image(input_image, detect_resolution)) control_image = HWC3(control_image) image = resize_image(input_image, image_resolution) H, W = image.shape[:2] control_image = cv2.resize(control_image, (W, H), interpolation=cv2.INTER_LINEAR) else: control_image = input_image return PIL.Image.fromarray(control_image), PIL.Image.fromarray( control_image)
10 unmodified lines num_steps: int, guidance_scale: float, seed: int, is_depth_image: bool, ) -> list[PIL.Image.Image]: control_image, vis_control_image = self.preprocess_depth( input_image=input_image, image_resolution=image_resolution, detect_resolution=detect_resolution, is_depth_image=is_depth_image, ) return self.process( task_name='depth',app_depth.py+3
app_pose.py+3
model.py+26-15