Kvikontent commited on
Commit
b5d38bf
1 Parent(s): 422c73d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -17
app.py CHANGED
@@ -18,23 +18,19 @@ interface = gr.Interface(
18
  )
19
 
20
  @spaces.GPU(duration=200)
21
- def generate_video(img):
22
- # Convert the input image to a tensor
23
- img_tensor = torch.tensor(img).unsqueeze(0) / 255.0
24
-
25
- # Run the pipeline to generate the video
26
- output = pipeline(img_tensor)
27
-
28
- # Extract the video frames from the output
29
- video_frames = output["video_frames"]
30
-
31
- # Convert the video frames to a video
32
- video = []
33
- for frame in video_frames:
34
- video.append(Image.fromarray(frame.detach().cpu().numpy()))
35
-
36
- # Return the generated video
37
- return video
38
 
39
  # Launch the Gradio app
40
  interface.launch()
 
18
  )
19
 
20
  @spaces.GPU(duration=200)
21
+ def generate_video(image):
22
+ """
23
+ Generates a video from an input image using the pipeline.
24
+
25
+ Args:
26
+ image: A PIL Image object representing the input image.
27
+
28
+ Returns:
29
+ A list of PIL Images representing the video frames.
30
+ """
31
+ video_frames = pipeline(image=image).images
32
+
33
+ return video_frames
 
 
 
 
34
 
35
  # Launch the Gradio app
36
  interface.launch()