Faizbulbul commited on
Commit
fddd343
·
verified ·
1 Parent(s): f6cb31b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -7
app.py CHANGED
@@ -2,24 +2,27 @@ import gradio as gr
2
  from diffusers import StableVideoDiffusionPipeline
3
  import torch
4
 
5
- # Model Load करो (CPU के लिए)
6
  pipe = StableVideoDiffusionPipeline.from_pretrained(
7
  "stabilityai/stable-video-diffusion-img2vid",
8
  torch_dtype=torch.float32
9
  )
10
 
11
- # Function जो Image से Video Generate करेगा
12
- def generate_video(image):
13
- video = pipe(image).frames
14
  return video
15
 
16
  # Gradio Interface बनाओ
17
  iface = gr.Interface(
18
  fn=generate_video,
19
- inputs=gr.Image(label="Upload an image"),
 
 
 
20
  outputs=gr.Video(label="Generated Video"),
21
  title="AI Video Generator",
22
- description="Upload an image to generate an AI video."
23
  )
24
 
25
- iface.launch()
 
2
  from diffusers import StableVideoDiffusionPipeline
3
  import torch
4
 
5
+ # Model Load करो (CPU पर)
6
  pipe = StableVideoDiffusionPipeline.from_pretrained(
7
  "stabilityai/stable-video-diffusion-img2vid",
8
  torch_dtype=torch.float32
9
  )
10
 
11
+ # Function: Image + Text Prompt से Video बनाएगा
12
+ def generate_video(image, prompt):
13
+ video = pipe(image, prompt=prompt).frames
14
  return video
15
 
16
  # Gradio Interface बनाओ
17
  iface = gr.Interface(
18
  fn=generate_video,
19
+ inputs=[
20
+ gr.Image(label="Upload an image"),
21
+ gr.Textbox(label="Enter Animation Prompt", placeholder="e.g. A cat running in a forest"),
22
+ ],
23
  outputs=gr.Video(label="Generated Video"),
24
  title="AI Video Generator",
25
+ description="Upload an image and enter a prompt to generate an AI video."
26
  )
27
 
28
+ iface.launch()