cakemus commited on
Commit
ec9e5f3
·
1 Parent(s): 52e14d6
Files changed (1) hide show
  1. app.py +11 -7
app.py CHANGED
@@ -4,20 +4,24 @@ from spaces import GPU # Import the GPU decorator for ZeroGPU
4
 
5
  # Use @GPU to allocate a GPU when running the video generation function
6
  @GPU
7
- def generate_video(prompt):
8
- # Load the Kandinsky 1.1 video model
9
  video_model = pipeline("video-generation", model="ai-forever/KandinskyVideo_1_1", device=0)
10
- # Generate video based on the prompt
11
- video = video_model(prompt)
 
12
  return video # Ensure this returns the video file or frames
13
 
14
- # Create the Gradio interface
15
  interface = gr.Interface(
16
  fn=generate_video,
17
- inputs=gr.Textbox(label="Enter your prompt here"),
 
 
 
18
  outputs="video",
19
  title="AI Video Generator",
20
- description="This app generates a short video based on your input prompt using Kandinsky 1.1.",
21
  theme="dark"
22
  )
23
 
 
4
 
5
  # Use @GPU to allocate a GPU when running the video generation function
6
  @GPU
7
+ def generate_video(prompt, image):
8
+ # Load the Kandinsky video model
9
  video_model = pipeline("video-generation", model="ai-forever/KandinskyVideo_1_1", device=0)
10
+
11
+ # Generate video based on the prompt and image
12
+ video = video_model(prompt=prompt, init_image=image)
13
  return video # Ensure this returns the video file or frames
14
 
15
+ # Create the Gradio interface with text and image inputs
16
  interface = gr.Interface(
17
  fn=generate_video,
18
+ inputs=[
19
+ gr.Textbox(label="Enter your prompt here"),
20
+ gr.Image(label="Upload an initial image") # Image upload input
21
+ ],
22
  outputs="video",
23
  title="AI Video Generator",
24
+ description="This app generates a short video based on your input prompt and initial image using Kandinsky 1.1.",
25
  theme="dark"
26
  )
27