rynmurdock commited on
Commit
68afba5
1 Parent(s): 6928bd2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -124,9 +124,8 @@ pipe.to(device=DEVICE)
124
  #assert len(output.frames[0]) == 16
125
  #leave_im_emb.detach().to('cpu')
126
 
127
-
128
  @spaces.GPU(duration=10)
129
- def generate(in_im_embs):
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
 
@@ -136,7 +135,11 @@ def generate(in_im_embs):
136
  output.frames[0][len(output.frames[0])//2], DEVICE, 1, output_hidden_state
137
  )
138
  im_emb = im_emb.detach().to('cpu').to(torch.float32)
 
139
 
 
 
 
140
  nsfw = maybe_nsfw(output.frames[0][len(output.frames[0])//2])
141
 
142
  name = str(uuid.uuid4()).replace("-", "")
 
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
 
 
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
 
140
+ def generate(in_im_embs):
141
+
142
+ output, im_emb = generate_gpu(in_im_embs)
143
  nsfw = maybe_nsfw(output.frames[0][len(output.frames[0])//2])
144
 
145
  name = str(uuid.uuid4()).replace("-", "")