fffiloni commited on
Commit
25b5212
1 Parent(s): 5089f52

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -5,7 +5,7 @@ import numpy as np
5
  from moviepy.editor import *
6
  from share_btn import community_icon_html, loading_icon_html, share_js
7
 
8
- from diffusers import DiffusionPipeline, EulerAncestralDiscreteScheduler
9
  import torch
10
  from PIL import Image
11
  import time
@@ -13,7 +13,7 @@ import psutil
13
  import random
14
 
15
 
16
- pipe = DiffusionPipeline.from_pretrained("timbrooks/instruct-pix2pix", torch_dtype=torch.float16, safety_checker=None)
17
  pipe.scheduler = EulerAncestralDiscreteScheduler.from_config(pipe.scheduler.config)
18
  pipe.enable_xformers_memory_efficient_attention()
19
  pipe.unet.to(memory_format=torch.channels_last)
@@ -127,13 +127,13 @@ def infer(prompt,video_in, seed_in, trim_value):
127
  for i in frames_list[0:int(n_frame)]:
128
  pix2pix_img = pix2pix(prompt,5.5,1.5,i,15,"",512,512,seed_in)
129
  print(pix2pix_img)
130
- #image = Image.open(pix2pix_img)
131
- #rgb_im = image.convert("RGB")
132
 
133
  # exporting the image
134
- #pix2pix_img.save(f"result_img-{i}.jpg")
135
- #result_frames.append(f"result_img-{i}.jpg")
136
- #print("frame " + i + "/" + str(n_frame) + ": done;")
137
 
138
  final_vid = create_video(result_frames, fps)
139
  print("finished !")
 
5
  from moviepy.editor import *
6
  from share_btn import community_icon_html, loading_icon_html, share_js
7
 
8
+ from diffusers import StableDiffusionInstructPix2PixPipeline, EulerAncestralDiscreteScheduler
9
  import torch
10
  from PIL import Image
11
  import time
 
13
  import random
14
 
15
 
16
+ pipe = StableDiffusionInstructPix2PixPipeline.from_pretrained("timbrooks/instruct-pix2pix", torch_dtype=torch.float16, safety_checker=None)
17
  pipe.scheduler = EulerAncestralDiscreteScheduler.from_config(pipe.scheduler.config)
18
  pipe.enable_xformers_memory_efficient_attention()
19
  pipe.unet.to(memory_format=torch.channels_last)
 
127
  for i in frames_list[0:int(n_frame)]:
128
  pix2pix_img = pix2pix(prompt,5.5,1.5,i,15,"",512,512,seed_in)
129
  print(pix2pix_img)
130
+ image = Image.open(pix2pix_img)
131
+ rgb_im = image.convert("RGB")
132
 
133
  # exporting the image
134
+ rgb_im.save(f"result_img-{i}.jpg")
135
+ result_frames.append(f"result_img-{i}.jpg")
136
+ print("frame " + i + "/" + str(n_frame) + ": done;")
137
 
138
  final_vid = create_video(result_frames, fps)
139
  print("finished !")