Ahsen Khaliq commited on
Commit
c6b75cf
1 Parent(s): d30b2a2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -114,7 +114,7 @@ normalize = transforms.Normalize(mean=[0.48145466, 0.4578275, 0.40821073],
114
  std=[0.26862954, 0.26130258, 0.27577711])
115
  lpips_model = lpips.LPIPS(net='vgg').to(device)
116
 
117
- def inference(text, image, skip_timesteps):
118
  all_frames = []
119
  prompts = [text]
120
  image_prompts = []
@@ -124,7 +124,10 @@ def inference(text, image, skip_timesteps):
124
  range_scale = 50 # Controls how far out of range RGB values are allowed to be.
125
  cutn = 16
126
  n_batches = 1
127
- init_image = image.name # This can be an URL or Colab local path and must be in quotes.
 
 
 
128
  skip_timesteps = skip_timesteps # This needs to be between approx. 200 and 500 when using an init image.
129
  # Higher values make the output look more like the init.
130
  init_scale = 0 # This enhances the effect of the init image, a good value is 1000.
 
114
  std=[0.26862954, 0.26130258, 0.27577711])
115
  lpips_model = lpips.LPIPS(net='vgg').to(device)
116
 
117
+ def inference(text, init_image, skip_timesteps):
118
  all_frames = []
119
  prompts = [text]
120
  image_prompts = []
 
124
  range_scale = 50 # Controls how far out of range RGB values are allowed to be.
125
  cutn = 16
126
  n_batches = 1
127
+ if init_image:
128
+ init_image = init_image.name
129
+ else:
130
+ init_image = None # This can be an URL or Colab local path and must be in quotes.
131
  skip_timesteps = skip_timesteps # This needs to be between approx. 200 and 500 when using an init image.
132
  # Higher values make the output look more like the init.
133
  init_scale = 0 # This enhances the effect of the init image, a good value is 1000.