Spaces:
				
			
			
	
			
			
		Running
		
			on 
			
			Zero
	
	
	
			
			
	
	
	
	
		
		
		Running
		
			on 
			
			Zero
	Update app.py
Browse files
    	
        app.py
    CHANGED
    
    | @@ -50,36 +50,36 @@ def generate(prompt, | |
| 50 | 
             
                        decode_timestep = 0.05,
         | 
| 51 | 
             
                        decode_noise_scale = 0.025,
         | 
| 52 | 
             
                        generator=torch.Generator().manual_seed(seed),
         | 
| 53 | 
            -
                        output_type="latent",
         | 
| 54 | 
             
                    ).frames
         | 
| 55 |  | 
| 56 | 
             
                # Part 2. Upscale generated video using latent upsampler with fewer inference steps
         | 
| 57 | 
             
                # The available latent upsampler upscales the height/width by 2x
         | 
| 58 | 
             
                upscaled_height, upscaled_width = downscaled_height * 2, downscaled_width * 2
         | 
| 59 | 
            -
                upscaled_latents = pipe_upsample(
         | 
| 60 | 
            -
             | 
| 61 | 
            -
             | 
| 62 | 
            -
                ).frames
         | 
| 63 |  | 
| 64 | 
            -
                # Part 3. Denoise the upscaled video with few steps to improve texture (optional, but recommended)
         | 
| 65 | 
            -
                video = pipe(
         | 
| 66 | 
            -
             | 
| 67 | 
            -
             | 
| 68 | 
            -
             | 
| 69 | 
            -
             | 
| 70 | 
            -
             | 
| 71 | 
            -
             | 
| 72 | 
            -
             | 
| 73 | 
            -
             | 
| 74 | 
            -
             | 
| 75 | 
            -
             | 
| 76 | 
            -
             | 
| 77 | 
            -
             | 
| 78 | 
            -
             | 
| 79 | 
            -
                ).frames[0]
         | 
| 80 |  | 
| 81 | 
             
                # Part 4. Downscale the video to the expected resolution
         | 
| 82 | 
            -
                video = [frame.resize((expected_width, expected_height)) for frame in  | 
| 83 | 
             
                return video
         | 
| 84 |  | 
| 85 |  | 
|  | |
| 50 | 
             
                        decode_timestep = 0.05,
         | 
| 51 | 
             
                        decode_noise_scale = 0.025,
         | 
| 52 | 
             
                        generator=torch.Generator().manual_seed(seed),
         | 
| 53 | 
            +
                        #output_type="latent",
         | 
| 54 | 
             
                    ).frames
         | 
| 55 |  | 
| 56 | 
             
                # Part 2. Upscale generated video using latent upsampler with fewer inference steps
         | 
| 57 | 
             
                # The available latent upsampler upscales the height/width by 2x
         | 
| 58 | 
             
                upscaled_height, upscaled_width = downscaled_height * 2, downscaled_width * 2
         | 
| 59 | 
            +
                # upscaled_latents = pipe_upsample(
         | 
| 60 | 
            +
                #     latents=latents,
         | 
| 61 | 
            +
                #     output_type="latent"
         | 
| 62 | 
            +
                # ).frames
         | 
| 63 |  | 
| 64 | 
            +
                # # Part 3. Denoise the upscaled video with few steps to improve texture (optional, but recommended)
         | 
| 65 | 
            +
                # video = pipe(
         | 
| 66 | 
            +
                #     conditions=condition1,
         | 
| 67 | 
            +
                #     prompt=prompt,
         | 
| 68 | 
            +
                #     negative_prompt=negative_prompt,
         | 
| 69 | 
            +
                #     width=upscaled_width,
         | 
| 70 | 
            +
                #     height=upscaled_height,
         | 
| 71 | 
            +
                #     num_frames=num_frames,
         | 
| 72 | 
            +
                #     denoise_strength=0.4,  # Effectively, 4 inference steps out of 10
         | 
| 73 | 
            +
                #     num_inference_steps=10,
         | 
| 74 | 
            +
                #     latents=upscaled_latents,
         | 
| 75 | 
            +
                #     decode_timestep=0.05,
         | 
| 76 | 
            +
                #     image_cond_noise_scale=0.025,
         | 
| 77 | 
            +
                #     generator=torch.Generator().manual_seed(seed),
         | 
| 78 | 
            +
                #     output_type="pil",
         | 
| 79 | 
            +
                # ).frames[0]
         | 
| 80 |  | 
| 81 | 
             
                # Part 4. Downscale the video to the expected resolution
         | 
| 82 | 
            +
                video = [frame.resize((expected_width, expected_height)) for frame in latents[0]]
         | 
| 83 | 
             
                return video
         | 
| 84 |  | 
| 85 |  | 
 
			
