Spaces:
Running
Running
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import imageio
|
3 |
+
import numpy as np
|
4 |
+
|
5 |
+
def image_to_video(image):
|
6 |
+
video_filename = "output.mp4"
|
7 |
+
writer = imageio.get_writer(video_filename, fps=10)
|
8 |
+
|
9 |
+
# Generate a simple video with repeated frames
|
10 |
+
for _ in range(30): # 30 frames (1 second at 30fps)
|
11 |
+
writer.append_data(image)
|
12 |
+
writer.close()
|
13 |
+
|
14 |
+
return video_filename
|
15 |
+
|
16 |
+
demo = gr.Interface(
|
17 |
+
fn=image_to_video,
|
18 |
+
inputs=gr.Image(type="numpy", label="Upload Image"),
|
19 |
+
outputs=gr.Video(),
|
20 |
+
title="Image to Video Converter",
|
21 |
+
description="Upload an image to generate a short looping video."
|
22 |
+
)
|
23 |
+
|
24 |
+
demo.launch()
|