quangnhat commited on
Commit
3de6666
·
1 Parent(s): e42b99a
Files changed (1) hide show
  1. app.py +5 -9
app.py CHANGED
@@ -32,16 +32,12 @@ def generate_video(prompt):
32
  print("Starting video generation...")
33
  start_time = time.time()
34
 
35
- # Generate video frames with a limit of 24 frames (approx. 5 seconds at 5 FPS)
36
- images = pipe(prompt, num_inference_steps=24).images
37
- print("Video frames generated successfully!")
38
 
39
- # Save the generated images as a video
40
  output_path = "generated_video.mp4"
41
-
42
- # Convert images to video
43
- import imageio
44
- imageio.mimsave(output_path, images, fps=5)
45
 
46
  end_time = time.time()
47
  print(f"Video saved to {output_path} in {end_time - start_time:.2f} seconds")
@@ -62,6 +58,6 @@ demo = gr.Interface(
62
 
63
  if __name__ == "__main__":
64
  if pipe is not None:
65
- demo.launch() # Removed timeout parameter
66
  else:
67
  print("Could not launch app due to model loading failure.")
 
32
  print("Starting video generation...")
33
  start_time = time.time()
34
 
35
+ # Generate video
36
+ output = pipe(prompt)
 
37
 
38
+ # Save the generated video
39
  output_path = "generated_video.mp4"
40
+ output.save_to_file(output_path)
 
 
 
41
 
42
  end_time = time.time()
43
  print(f"Video saved to {output_path} in {end_time - start_time:.2f} seconds")
 
58
 
59
  if __name__ == "__main__":
60
  if pipe is not None:
61
+ demo.launch(share=True) # Set share=True to create a public link
62
  else:
63
  print("Could not launch app due to model loading failure.")