grbell commited on
Commit
d2e9a17
·
verified ·
1 Parent(s): be91394

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -20
app.py CHANGED
@@ -42,23 +42,21 @@ st.title("Image to Video")
42
 
43
  file_name = st.file_uploader("Upload an image")
44
 
45
- # if file_name is None:
46
- # return
47
-
48
- col1, col2 = st.columns(2)
49
- image = load_image(image=file_name.name)
50
- col1.image(image, use_container_width=True)
51
-
52
- video = pipe(
53
- prompt=prompt,
54
- image=image,
55
- num_videos_per_prompt=1,
56
- num_inference_steps=50,
57
- num_frames=49,
58
- guidance_scale=6,
59
- generator=torch.Generator(device="cuda").manual_seed(42),
60
- ).frames[0]
61
-
62
- col2.video(video, use_container_width=True)
63
-
64
- export_to_video(video, "output.mp4", fps=8)
 
42
 
43
  file_name = st.file_uploader("Upload an image")
44
 
45
+ if file_name is not None:
46
+ col1, col2 = st.columns(2)
47
+ image = load_image(image=file_name.name)
48
+ col1.image(image, use_container_width=True)
49
+
50
+ video = pipe(
51
+ prompt=prompt,
52
+ image=image,
53
+ num_videos_per_prompt=1,
54
+ num_inference_steps=50,
55
+ num_frames=49,
56
+ guidance_scale=6,
57
+ generator=torch.Generator(device="cuda").manual_seed(42),
58
+ ).frames[0]
59
+
60
+ col2.video(video, use_container_width=True)
61
+
62
+ export_to_video(video, "output.mp4", fps=8)