rynmurdock commited on
Commit
a4f79b1
·
1 Parent(s): 68afba5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -124,16 +124,18 @@ pipe.to(device=DEVICE)
124
  #assert len(output.frames[0]) == 16
125
  #leave_im_emb.detach().to('cpu')
126
 
127
- @spaces.GPU(duration=10)
128
  def generate_gpu(in_im_embs):
 
129
  in_im_embs = in_im_embs.to('cuda').unsqueeze(0).unsqueeze(0)
130
  #im_embs = torch.cat((torch.zeros(1, 1280, device=DEVICE, dtype=dtype), in_im_embs), 0)
131
 
132
  output = pipe(prompt='a scene', guidance_scale=0, added_cond_kwargs={}, ip_adapter_image_embeds=[in_im_embs], num_inference_steps=STEPS)
133
-
134
  im_emb, _ = pipe.encode_image(
135
- output.frames[0][len(output.frames[0])//2], DEVICE, 1, output_hidden_state
136
  )
 
137
  im_emb = im_emb.detach().to('cpu').to(torch.float32)
138
  return output, im_emb
139
 
 
124
  #assert len(output.frames[0]) == 16
125
  #leave_im_emb.detach().to('cpu')
126
 
127
+ @spaces.GPU(duration=20)
128
  def generate_gpu(in_im_embs):
129
+ print('start gen')
130
  in_im_embs = in_im_embs.to('cuda').unsqueeze(0).unsqueeze(0)
131
  #im_embs = torch.cat((torch.zeros(1, 1280, device=DEVICE, dtype=dtype), in_im_embs), 0)
132
 
133
  output = pipe(prompt='a scene', guidance_scale=0, added_cond_kwargs={}, ip_adapter_image_embeds=[in_im_embs], num_inference_steps=STEPS)
134
+ print('image is made')
135
  im_emb, _ = pipe.encode_image(
136
+ output.frames[0][len(output.frames[0])//2], 'cuda', 1, output_hidden_state
137
  )
138
+ print('im_emb is made')
139
  im_emb = im_emb.detach().to('cpu').to(torch.float32)
140
  return output, im_emb
141