fbnnb commited on
Commit
3da35eb
Β·
verified Β·
1 Parent(s): a9cbc4c

Update gradio_app.py

Browse files
Files changed (1) hide show
  1. gradio_app.py +15 -1
gradio_app.py CHANGED
@@ -240,7 +240,21 @@ def get_image(model, prompts, image1, image2, noise_shape, n_samples=1, ddim_ste
240
  batch_variants.append(batch_images)
241
  ## variants, batch, c, t, h, w
242
  batch_variants = torch.stack(batch_variants)
243
- return batch_variants.permute(1, 0, 2, 3, 4, 5)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
244
 
245
 
246
 
 
240
  batch_variants.append(batch_images)
241
  ## variants, batch, c, t, h, w
242
  batch_variants = torch.stack(batch_variants)
243
+ # return batch_variants.permute(1, 0, 2, 3, 4, 5)
244
+
245
+ prompt_str = prompt.replace("/", "_slash_") if "/" in prompt else prompt
246
+ prompt_str = prompt_str.replace(" ", "_") if " " in prompt else prompt_str
247
+ prompt_str=prompt_str[:40]
248
+ if len(prompt_str) == 0:
249
+ prompt_str = 'empty_prompt'
250
+
251
+ result_dir = "./tmp/"
252
+ save_videos(batch_image, result_dir, filenames=[prompt_str], fps=8)
253
+ print(f"Saved in {prompt_str}. Time used: {(time.time() - start):.2f} seconds")
254
+ model = model.cpu()
255
+ saved_result_dir = os.path.join(result_dir, f"{prompt_str}.mp4")
256
+ print("result saved to:", saved_result_dir)
257
+ return saved_result_dir
258
 
259
 
260