Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -10,27 +10,31 @@ pipe.scheduler = EulerDiscreteScheduler.from_config(pipe.scheduler.config)
|
|
10 |
pipe.to("cuda")
|
11 |
|
12 |
@spaces.GPU
|
13 |
-
def generate_video(image, prompt, num_frames=25,
|
14 |
# Generate the video
|
15 |
-
video_frames = pipe(prompt, image=image, num_frames=num_frames, height=
|
16 |
return video_frames
|
17 |
|
18 |
# Create the Gradio interface
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
gr.
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
|
|
|
|
|
|
|
|
|
|
32 |
|
33 |
# Launch the interface
|
34 |
if __name__ == "__main__":
|
35 |
-
|
36 |
-
|
|
|
10 |
pipe.to("cuda")
|
11 |
|
12 |
@spaces.GPU
|
13 |
+
def generate_video(image, prompt, num_frames=25, height=576, width=1024):
|
14 |
# Generate the video
|
15 |
+
video_frames = pipe(prompt, image=image, num_frames=num_frames, height=height, width=width).frames
|
16 |
return video_frames
|
17 |
|
18 |
# Create the Gradio interface
|
19 |
+
with gr.Blocks() as demo:
|
20 |
+
gr.Markdown("## Image to Video with Stable Diffusion XT")
|
21 |
+
with gr.Row():
|
22 |
+
with gr.Column():
|
23 |
+
image_input = gr.Image(type="pil", label="Upload Image")
|
24 |
+
prompt_input = gr.Textbox(lines=2, placeholder="Enter prompt...", label="Prompt")
|
25 |
+
num_frames_input = gr.Slider(1, 50, step=1, default=25, label="Number of Frames")
|
26 |
+
height_input = gr.Number(label="Resolution Height", default=576)
|
27 |
+
width_input = gr.Number(label="Resolution Width", default=1024)
|
28 |
+
run_button = gr.Button("Generate Video")
|
29 |
+
with gr.Column():
|
30 |
+
video_output = gr.Video(label="Generated Video")
|
31 |
+
|
32 |
+
run_button.click(
|
33 |
+
generate_video,
|
34 |
+
inputs=[image_input, prompt_input, num_frames_input, height_input, width_input],
|
35 |
+
outputs=video_output
|
36 |
+
)
|
37 |
|
38 |
# Launch the interface
|
39 |
if __name__ == "__main__":
|
40 |
+
demo.launch()
|
|